* Help getting started debugging Emacs on macOS Sierra
@ 2017-08-10 23:25 Itai Berli
2017-08-11 3:04 ` Paul Eggert
2017-08-11 6:28 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-10 23:25 UTC (permalink / raw)
To: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]
Hello.
I'm new to Emacs development.
I'm interesting in exploring the Emacs bidi feature, which is coded in the
files bidi.c and xdisp.c.
To get my feet wet, I'd like to set a breakpoint in the beginning of one of
the functions in one of these files, I don't care which one, and step
through the function in a debugger.
Not only am I new to Emacs development, I'm also new to developing C
programs. Ideally, I'd like to do this in the Eclipse IDE for C/C++
Developers (Oxygen Release 4.7.0). However, I'm also willing to try another
debugger, such as a command-line one, if it's easier to get started.
My operating system is macOS Sierra Version 10.12.6 (the latest version).
My LLVM version is 8.1.0 (clang-802.0.42).
I'll appreciate it if someone can walk me through the steps needed to get
up and running.
I have downloaded Emacs from git by running
> git clone git://git.savannah.gnu.org/emacs.git
I then compiled and installed it by running the following sequence of
scripts.
> ./autogen.sh
> ./autogen.sh git
> ./configure
> make
> make install
All the scripts finished successfully. In the end I was able to start the
Emacs GUI from the command line by running
> open nextstep/Emacs.app
The Emacs version that displayed was GNU Emacs 26.0.50 (build 1,
x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G29)).
[-- Attachment #2: Type: text/html, Size: 2140 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-10 23:25 Help getting started debugging Emacs on macOS Sierra Itai Berli
@ 2017-08-11 3:04 ` Paul Eggert
2017-08-11 5:06 ` Itai Berli
2017-08-11 6:28 ` Eli Zaretskii
1 sibling, 1 reply; 42+ messages in thread
From: Paul Eggert @ 2017-08-11 3:04 UTC (permalink / raw)
To: Itai Berli, Emacs developers
Itai Berli wrote:
> I'll appreciate it if someone can walk me through the steps needed to get
> up and running....
> All the scripts finished successfully. In the end I was able to start the
> Emacs GUI from the command line by running
>
>> open nextstep/Emacs.app
You've gotten up and running, so it sounds like all you need to do is to learn
how to debug.
I normally use gdb under Emacs to debug Emacs. To do that, I run Emacs in the
source directory, type the command "M-x gud-gdb RET bootstrap-emacs RET" to get
GDB running on a subsidiary instance of Emacs, type the GDB command "b
Fexpand_file_name" to plant a breakpoint in (say) Fexpand_file_name, and then
type the GDB command "r" to run the Emacs being debugged.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 3:04 ` Paul Eggert
@ 2017-08-11 5:06 ` Itai Berli
2017-08-11 8:47 ` Paul Eggert
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 5:06 UTC (permalink / raw)
To: Emacs developers; +Cc: Paul Eggert
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
Thanks, Paul. Do you use macOS? I read that Macs don't use gdb natively,
but instead an alternative called LLVM. At any rate, gdb is not installed
on my system. I can download and install it, but I'm a little hesitant, as
I'm afraid it might clash with LLVM.
On Fri, Aug 11, 2017 at 6:04 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Itai Berli wrote:
>
>> I'll appreciate it if someone can walk me through the steps needed to get
>> up and running....
>>
>
> All the scripts finished successfully. In the end I was able to start the
>> Emacs GUI from the command line by running
>>
>> open nextstep/Emacs.app
>>>
>>
> You've gotten up and running, so it sounds like all you need to do is to
> learn how to debug.
>
> I normally use gdb under Emacs to debug Emacs. To do that, I run Emacs in
> the source directory, type the command "M-x gud-gdb RET bootstrap-emacs
> RET" to get GDB running on a subsidiary instance of Emacs, type the GDB
> command "b Fexpand_file_name" to plant a breakpoint in (say)
> Fexpand_file_name, and then type the GDB command "r" to run the Emacs being
> debugged.
>
[-- Attachment #2: Type: text/html, Size: 1871 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-10 23:25 Help getting started debugging Emacs on macOS Sierra Itai Berli
2017-08-11 3:04 ` Paul Eggert
@ 2017-08-11 6:28 ` Eli Zaretskii
2017-08-11 8:27 ` Itai Berli
1 sibling, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 6:28 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 02:25:17 +0300
>
> I'm interesting in exploring the Emacs bidi feature, which is coded in the files bidi.c and xdisp.c.
>
> To get my feet wet, I'd like to set a breakpoint in the beginning of one of the functions in one of these files, I
> don't care which one, and step through the function in a debugger.
>
> Not only am I new to Emacs development, I'm also new to developing C programs. Ideally, I'd like to do this in
> the Eclipse IDE for C/C++ Developers (Oxygen Release 4.7.0). However, I'm also willing to try another
> debugger, such as a command-line one, if it's easier to get started.
>
> My operating system is macOS Sierra Version 10.12.6 (the latest version). My LLVM version is 8.1.0
> (clang-802.0.42).
>
> I'll appreciate it if someone can walk me through the steps needed to get up and running.
I don't use macOS, and so cannot tell you how to use lldb to debug
Emacs. Some advice is in etc/DEBUG, but its most useful parts are
heavily skewed towards GDB. So if possible, I suggest to install GDB
for macOS, I'm sure some version of it is available. That would allow
more people here to help you with specific commands and features of
the debugger. Debugging support in src/.gdbinit is also GDB-specific,
and I don't know how well does lldb emulate GDB for the commands
defined on .gdbinit to work in lldb.
> I have downloaded Emacs from git by running
>
> > git clone git://git.savannah.gnu.org/emacs.git
>
> I then compiled and installed it by running the following sequence of scripts.
>
> > ./autogen.sh
> > ./autogen.sh git
> > ./configure
> > make
> > make install
The default build uses optimization switches, which make debugging
harder. So I suggest to rebuild Emacs without optimizations and with
better debugging info:
CFLAGS='-O0 -g3' ./configure
make
make install
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 6:28 ` Eli Zaretskii
@ 2017-08-11 8:27 ` Itai Berli
2017-08-11 9:30 ` Eli Zaretskii
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 8:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 2287 bytes --]
Eli wrote:
> I suggest to rebuild Emacs without optimizations and with better
debugging info:
>
> CFLAGS='-O0 -g3' ./configure
> make
> make install
Thank you, Eli. Do I also need to run './autogen.sh' and './autogen.sh git'
again?
On Fri, Aug 11, 2017 at 9:28 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Fri, 11 Aug 2017 02:25:17 +0300
> >
> > I'm interesting in exploring the Emacs bidi feature, which is coded in
> the files bidi.c and xdisp.c.
> >
> > To get my feet wet, I'd like to set a breakpoint in the beginning of one
> of the functions in one of these files, I
> > don't care which one, and step through the function in a debugger.
> >
> > Not only am I new to Emacs development, I'm also new to developing C
> programs. Ideally, I'd like to do this in
> > the Eclipse IDE for C/C++ Developers (Oxygen Release 4.7.0). However,
> I'm also willing to try another
> > debugger, such as a command-line one, if it's easier to get started.
> >
> > My operating system is macOS Sierra Version 10.12.6 (the latest
> version). My LLVM version is 8.1.0
> > (clang-802.0.42).
> >
> > I'll appreciate it if someone can walk me through the steps needed to
> get up and running.
>
> I don't use macOS, and so cannot tell you how to use lldb to debug
> Emacs. Some advice is in etc/DEBUG, but its most useful parts are
> heavily skewed towards GDB. So if possible, I suggest to install GDB
> for macOS, I'm sure some version of it is available. That would allow
> more people here to help you with specific commands and features of
> the debugger. Debugging support in src/.gdbinit is also GDB-specific,
> and I don't know how well does lldb emulate GDB for the commands
> defined on .gdbinit to work in lldb.
>
> > I have downloaded Emacs from git by running
> >
> > > git clone git://git.savannah.gnu.org/emacs.git
> >
> > I then compiled and installed it by running the following sequence of
> scripts.
> >
> > > ./autogen.sh
> > > ./autogen.sh git
> > > ./configure
> > > make
> > > make install
>
> The default build uses optimization switches, which make debugging
> harder. So I suggest to rebuild Emacs without optimizations and with
> better debugging info:
>
> CFLAGS='-O0 -g3' ./configure
> make
> make install
>
[-- Attachment #2: Type: text/html, Size: 3432 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 5:06 ` Itai Berli
@ 2017-08-11 8:47 ` Paul Eggert
2017-08-11 8:57 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Paul Eggert @ 2017-08-11 8:47 UTC (permalink / raw)
To: Itai Berli, Emacs developers
Itai Berli wrote:
> At any rate, gdb is not installed
> on my system. I can download and install it, but I'm a little hesitant, as
> I'm afraid it might clash with LLVM.
It won't break anything; although GDB consumes LLVM's output, it does not affect
what LLVM does.
You don't need to rerun autogen.sh merely because you re-ran 'configure'.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 8:47 ` Paul Eggert
@ 2017-08-11 8:57 ` Itai Berli
2017-08-11 9:27 ` Itai Berli
2017-08-11 9:35 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-11 8:57 UTC (permalink / raw)
To: Paul Eggert, Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
OK. So I've installed gdb, and rebuilt Emacs as Eli suggested. I have then
imported the project to Eclipse IDE for C/C++ Developers (Oxygen Release
4.7.0). I have no trouble running the GUI from Eclipse. However, when when
I try to debug it, I get the following error message:
---
'Launching emacs-26.0.50.1' has encountered a problem.
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
During startup program terminated with signal ?, Unknown signal.
During startup program terminated with signal ?, Unknown signal.
---
On Fri, Aug 11, 2017 at 11:47 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Itai Berli wrote:
>
>> At any rate, gdb is not installed
>> on my system. I can download and install it, but I'm a little hesitant, as
>> I'm afraid it might clash with LLVM.
>>
>
> It won't break anything; although GDB consumes LLVM's output, it does not
> affect what LLVM does.
>
> You don't need to rerun autogen.sh merely because you re-ran 'configure'.
>
[-- Attachment #2: Type: text/html, Size: 2035 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 8:57 ` Itai Berli
@ 2017-08-11 9:27 ` Itai Berli
2017-08-11 9:52 ` Eli Zaretskii
2017-08-11 9:35 ` Eli Zaretskii
1 sibling, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 9:27 UTC (permalink / raw)
To: Paul Eggert, Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]
Paul Eggert wrote:
> type the GDB command "b Fexpand_file_name" to plant a breakpoint in (say)
Fexpand_file_name
What do you mean by 'Fexpand_file_name'? The name of a file, or the name of
a function? Could you give me a concrete example? Suppose, for instance, I
wish to place a breakpoint at the start of the 'main; function. How can I
do so?
On Fri, Aug 11, 2017 at 11:57 AM, Itai Berli <itai.berli@gmail.com> wrote:
> OK. So I've installed gdb, and rebuilt Emacs as Eli suggested. I have then
> imported the project to Eclipse IDE for C/C++ Developers (Oxygen Release
> 4.7.0). I have no trouble running the GUI from Eclipse. However, when when
> I try to debug it, I get the following error message:
>
> ---
> 'Launching emacs-26.0.50.1' has encountered a problem.
> Error in final launch sequence
> Failed to execute MI command:
> -exec-run
> Error message from debugger back end:
> During startup program terminated with signal ?, Unknown signal.
> During startup program terminated with signal ?, Unknown signal.
> ---
>
> On Fri, Aug 11, 2017 at 11:47 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
>
>> Itai Berli wrote:
>>
>>> At any rate, gdb is not installed
>>> on my system. I can download and install it, but I'm a little hesitant,
>>> as
>>> I'm afraid it might clash with LLVM.
>>>
>>
>> It won't break anything; although GDB consumes LLVM's output, it does not
>> affect what LLVM does.
>>
>> You don't need to rerun autogen.sh merely because you re-ran 'configure'.
>>
>
>
[-- Attachment #2: Type: text/html, Size: 3060 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 8:27 ` Itai Berli
@ 2017-08-11 9:30 ` Eli Zaretskii
0 siblings, 0 replies; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 9:30 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 11:27:25 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> > I suggest to rebuild Emacs without optimizations and with better debugging info:
> >
> > CFLAGS='-O0 -g3' ./configure
> > make
> > make install
>
> Thank you, Eli. Do I also need to run './autogen.sh' and './autogen.sh git' again?
No, running autogen.sh is a one-time thing.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 8:57 ` Itai Berli
2017-08-11 9:27 ` Itai Berli
@ 2017-08-11 9:35 ` Eli Zaretskii
1 sibling, 0 replies; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 9:35 UTC (permalink / raw)
To: Itai Berli; +Cc: eggert, emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 11:57:10 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> OK. So I've installed gdb, and rebuilt Emacs as Eli suggested. I have then imported the project to Eclipse IDE
> for C/C++ Developers (Oxygen Release 4.7.0). I have no trouble running the GUI from Eclipse. However,
> when when I try to debug it, I get the following error message:
>
> ---
> 'Launching emacs-26.0.50.1' has encountered a problem.
> Error in final launch sequence
> Failed to execute MI command:
> -exec-run
> Error message from debugger back end:
> During startup program terminated with signal ?, Unknown signal.
> During startup program terminated with signal ?, Unknown signal.
I don't use Eclipse, so I'm stabbing in the dark here. The error
message means that there's some problem between Eclipse and the
underlying debugger with respect to GDB/MI commands emitted by
Eclipse. Google finds several discussions for these error messages,
so maybe you will b e able to find a solution there.
An alternative is to use the Emacs's front-end for GDB, it is started
with "M-x gdb RET".
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 9:27 ` Itai Berli
@ 2017-08-11 9:52 ` Eli Zaretskii
2017-08-11 9:55 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 9:52 UTC (permalink / raw)
To: Itai Berli; +Cc: eggert, emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 12:27:01 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> Paul Eggert wrote:
>
> > type the GDB command "b Fexpand_file_name" to plant a breakpoint in (say) Fexpand_file_name
>
> What do you mean by 'Fexpand_file_name'? The name of a file, or the name of a function?
It's the name of a function.
> Could you give me
> a concrete example? Suppose, for instance, I wish to place a breakpoint at the start of the 'main; function. How
> can I do so?
"b main". "b" is a short for "break".
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 9:52 ` Eli Zaretskii
@ 2017-08-11 9:55 ` Itai Berli
2017-08-11 9:59 ` Itai Berli
2017-08-11 12:43 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-11 9:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Paul Eggert, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 786 bytes --]
Typing "b main<RET>" in the *gud* buffer results in the following error
message:
> Current buffer has no process
On Fri, Aug 11, 2017 at 12:52 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Fri, 11 Aug 2017 12:27:01 +0300
> > Cc: Emacs developers <emacs-devel@gnu.org>
> >
> > Paul Eggert wrote:
> >
> > > type the GDB command "b Fexpand_file_name" to plant a breakpoint in
> (say) Fexpand_file_name
> >
> > What do you mean by 'Fexpand_file_name'? The name of a file, or the name
> of a function?
>
> It's the name of a function.
>
> > Could you give me
> > a concrete example? Suppose, for instance, I wish to place a breakpoint
> at the start of the 'main; function. How
> > can I do so?
>
> "b main". "b" is a short for "break".
>
[-- Attachment #2: Type: text/html, Size: 1408 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 9:55 ` Itai Berli
@ 2017-08-11 9:59 ` Itai Berli
2017-08-11 10:09 ` Itai Berli
2017-08-11 12:43 ` Eli Zaretskii
1 sibling, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 9:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Paul Eggert, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
By the way, the *gud* buffer's first line is
> Current directory is ~/
However, the Emacs source code is in ~/emacs. Maybe this is the problem?
But I started Emacs from ~/emacs. How can I set the *gud* buffer's current
directory?
On Fri, Aug 11, 2017 at 12:55 PM, Itai Berli <itai.berli@gmail.com> wrote:
> Typing "b main<RET>" in the *gud* buffer results in the following error
> message:
>
> > Current buffer has no process
>
> On Fri, Aug 11, 2017 at 12:52 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Itai Berli <itai.berli@gmail.com>
>> > Date: Fri, 11 Aug 2017 12:27:01 +0300
>> > Cc: Emacs developers <emacs-devel@gnu.org>
>> >
>> > Paul Eggert wrote:
>> >
>> > > type the GDB command "b Fexpand_file_name" to plant a breakpoint in
>> (say) Fexpand_file_name
>> >
>> > What do you mean by 'Fexpand_file_name'? The name of a file, or the
>> name of a function?
>>
>> It's the name of a function.
>>
>> > Could you give me
>> > a concrete example? Suppose, for instance, I wish to place a breakpoint
>> at the start of the 'main; function. How
>> > can I do so?
>>
>> "b main". "b" is a short for "break".
>>
>
>
[-- Attachment #2: Type: text/html, Size: 2176 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 9:59 ` Itai Berli
@ 2017-08-11 10:09 ` Itai Berli
2017-08-11 11:46 ` Tino Calancha
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 10:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Paul Eggert, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 2827 bytes --]
OK, I think I misunderstood Paul's command line "M-x gud-gdb RET
bootstrap-emacs RET" as meaning that after executing "M-x gud-gdb RET" the
only thing that should appear after the prompt is "bootstrap-emacs", so I
deleted the "gdb --full-name" prefix that appeared there automatically. If
I keep this prefix, the error reported above doesn't occur. However, now I
get the following complaint from gdb:
> No executable file specified.
> Use the "file" or "exec-file" command.
Here's the complete contents of the *gud* buffer.
Current directory is ~/
GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin16.6.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
bootstrap-emacs: No such file or directory.
(gdb) b main
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (main) pending.
(gdb) r
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.
On Fri, Aug 11, 2017 at 12:59 PM, Itai Berli <itai.berli@gmail.com> wrote:
> By the way, the *gud* buffer's first line is
>
> > Current directory is ~/
>
> However, the Emacs source code is in ~/emacs. Maybe this is the problem?
> But I started Emacs from ~/emacs. How can I set the *gud* buffer's current
> directory?
>
> On Fri, Aug 11, 2017 at 12:55 PM, Itai Berli <itai.berli@gmail.com> wrote:
>
>> Typing "b main<RET>" in the *gud* buffer results in the following error
>> message:
>>
>> > Current buffer has no process
>>
>> On Fri, Aug 11, 2017 at 12:52 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> > From: Itai Berli <itai.berli@gmail.com>
>>> > Date: Fri, 11 Aug 2017 12:27:01 +0300
>>> > Cc: Emacs developers <emacs-devel@gnu.org>
>>> >
>>> > Paul Eggert wrote:
>>> >
>>> > > type the GDB command "b Fexpand_file_name" to plant a breakpoint in
>>> (say) Fexpand_file_name
>>> >
>>> > What do you mean by 'Fexpand_file_name'? The name of a file, or the
>>> name of a function?
>>>
>>> It's the name of a function.
>>>
>>> > Could you give me
>>> > a concrete example? Suppose, for instance, I wish to place a
>>> breakpoint at the start of the 'main; function. How
>>> > can I do so?
>>>
>>> "b main". "b" is a short for "break".
>>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 6491 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 10:09 ` Itai Berli
@ 2017-08-11 11:46 ` Tino Calancha
2017-08-11 12:14 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Tino Calancha @ 2017-08-11 11:46 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]
On Fri, 11 Aug 2017, Itai Berli wrote:
> However, now I get the
> following complaint from gdb:
>
> > No executable file specified.
> > Use the "file" or "exec-file" command.
That means, gdb doesn't know which program to debug.
> Here's the complete contents of the *gud* buffer.
> Current directory is ~/
> No symbol table is loaded. Use the "file" command.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (main) pending.
> (gdb) r
> Starting program:
> No executable file specified.
> Use the "file" or "exec-file" command.
Assuming your executable is at:
~/emacs/src/bootstrap-emacs
you can do in the gdb command line:
file ~/emacs/src/bootstrap-emacs
> On Fri, Aug 11, 2017 at 12:59 PM, Itai Berli <itai.berli@gmail.com> wrote:
> By the way, the *gud* buffer's first line is
> > Current directory is ~/
>
> However, the Emacs source code is in ~/emacs. Maybe this is the problem? But I started Emacs from ~/emacs. How can I set
> the *gud* buffer's current directory?
DUNNO why it doesn't starts at ~/emacs.
You can try from a terminal:
|> emacs ~/emacs/src
;; now call gdb
M-x gdb RET ; it should offer to debug 'bootstrap-emacs'
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 11:46 ` Tino Calancha
@ 2017-08-11 12:14 ` Itai Berli
2017-08-11 12:33 ` Tino Calancha
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 12:14 UTC (permalink / raw)
To: Tino Calancha; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]
Thanks, Tino.
I've finally managed to get gdb to work by executing the following two
instructions at the gdb command prompt:
(gdb) cd ~/emacs
(gdb) file src/bootstrap-emacs
However, your suggestion to execute the following from the terminal, didn't
work:
> emacs ~/emacs/src
Is there a way to configure gdb to use the above settings (cd and file)
automatically?
On Fri, Aug 11, 2017 at 2:46 PM, Tino Calancha <tino.calancha@gmail.com>
wrote:
>
>
> On Fri, 11 Aug 2017, Itai Berli wrote:
>
> However, now I get the
>> following complaint from gdb:
>>
>> > No executable file specified.
>> > Use the "file" or "exec-file" command.
>>
> That means, gdb doesn't know which program to debug.
>
> Here's the complete contents of the *gud* buffer.
>>
>
> Current directory is ~/
>> No symbol table is loaded. Use the "file" command.
>> Make breakpoint pending on future shared library load? (y or [n]) y
>> Breakpoint 1 (main) pending.
>> (gdb) r
>> Starting program:
>> No executable file specified.
>> Use the "file" or "exec-file" command.
>>
> Assuming your executable is at:
> ~/emacs/src/bootstrap-emacs
> you can do in the gdb command line:
> file ~/emacs/src/bootstrap-emacs
>
> On Fri, Aug 11, 2017 at 12:59 PM, Itai Berli <itai.berli@gmail.com> wrote:
>> By the way, the *gud* buffer's first line is
>> > Current directory is ~/
>>
>> However, the Emacs source code is in ~/emacs. Maybe this is the problem?
>> But I started Emacs from ~/emacs. How can I set
>> the *gud* buffer's current directory?
>>
> DUNNO why it doesn't starts at ~/emacs.
> You can try from a terminal:
> |> emacs ~/emacs/src
> ;; now call gdb
> M-x gdb RET ; it should offer to debug 'bootstrap-emacs'
[-- Attachment #2: Type: text/html, Size: 3058 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 12:14 ` Itai Berli
@ 2017-08-11 12:33 ` Tino Calancha
2017-08-11 12:40 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Tino Calancha @ 2017-08-11 12:33 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers
On Fri, 11 Aug 2017, Itai Berli wrote:
> Thanks, Tino.
> I've finally managed to get gdb to work by executing the following two instructions at the gdb command prompt:
> (gdb) cd ~/emacs
> (gdb) file src/bootstrap-emacs
>
> However, your suggestion to execute the following from the terminal, didn't work:
>
> > emacs ~/emacs/src
Oh, i think you mention you run Emacs with:
open nextstep/Emacs.app
i don't have mac but i guess the following might work (*):
open -a nextstep/Emacs.app ~/emacs/src
(*) https://www.emacswiki.org/emacs/EmacsForMacOS#toc17
In case it works, then call from Emacs the gdb front-end:
M-x gdb RET
;; You must see something like:
gdb -i=mi bootstrap-emacs
;; Just enter and gdb would have loaded the Emacs executable
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 12:33 ` Tino Calancha
@ 2017-08-11 12:40 ` Itai Berli
2017-08-11 12:48 ` Tino Calancha
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 12:40 UTC (permalink / raw)
To: Tino Calancha; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 960 bytes --]
Thanks. What does the '-i=mi' mean? I don't see the '-i' option on the gdb
man page.
On Fri, Aug 11, 2017 at 3:33 PM, Tino Calancha <tino.calancha@gmail.com>
wrote:
>
>
> On Fri, 11 Aug 2017, Itai Berli wrote:
>
> Thanks, Tino.
>> I've finally managed to get gdb to work by executing the following two
>> instructions at the gdb command prompt:
>> (gdb) cd ~/emacs
>> (gdb) file src/bootstrap-emacs
>>
>> However, your suggestion to execute the following from the terminal,
>> didn't work:
>>
>> > emacs ~/emacs/src
>>
> Oh, i think you mention you run Emacs with:
> open nextstep/Emacs.app
>
> i don't have mac but i guess the following might work (*):
> open -a nextstep/Emacs.app ~/emacs/src
>
> (*) https://www.emacswiki.org/emacs/EmacsForMacOS#toc17
>
> In case it works, then call from Emacs the gdb front-end:
> M-x gdb RET
> ;; You must see something like:
> gdb -i=mi bootstrap-emacs
> ;; Just enter and gdb would have loaded the Emacs executable
>
[-- Attachment #2: Type: text/html, Size: 1625 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 9:55 ` Itai Berli
2017-08-11 9:59 ` Itai Berli
@ 2017-08-11 12:43 ` Eli Zaretskii
1 sibling, 0 replies; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 12:43 UTC (permalink / raw)
To: Itai Berli; +Cc: eggert, emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 12:55:38 +0300
> Cc: Paul Eggert <eggert@cs.ucla.edu>, Emacs developers <emacs-devel@gnu.org>
>
> Typing "b main<RET>" in the *gud* buffer results in the following error message:
>
> > Current buffer has no process
You didn't start the debugging session correctly.
Here's a full recipe:
M-x cd RET /where/you/have/emacs/binary RET
M-x gud-gdb RET
<edit the command to leave only "emacs", not "bootstrap-emacs">
RET
After the last RET you should see a (gdb) prompt in the "*gud-emacs*
buffer.
(gdb) b main
(gdb) run -Q
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 12:40 ` Itai Berli
@ 2017-08-11 12:48 ` Tino Calancha
2017-08-11 13:17 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Tino Calancha @ 2017-08-11 12:48 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers
On Fri, 11 Aug 2017, Itai Berli wrote:
> Thanks. What does the '-i=mi' mean? I don't see the '-i' option on the gdb man page.
That is to use gdb's MI text interface (*).
You don't need to worry about that to start using gdb.
(*) https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 12:48 ` Tino Calancha
@ 2017-08-11 13:17 ` Itai Berli
2017-08-11 13:20 ` Tino Calancha
2017-08-11 14:18 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-11 13:17 UTC (permalink / raw)
To: Tino Calancha; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
And what is the difference between gdb and gud-gdb?
On Fri, Aug 11, 2017 at 3:48 PM, Tino Calancha <tino.calancha@gmail.com>
wrote:
>
>
> On Fri, 11 Aug 2017, Itai Berli wrote:
>
> Thanks. What does the '-i=mi' mean? I don't see the '-i' option on the gdb
>> man page.
>>
> That is to use gdb's MI text interface (*).
> You don't need to worry about that to start using gdb.
> (*) https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html
>
>
[-- Attachment #2: Type: text/html, Size: 1067 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 13:17 ` Itai Berli
@ 2017-08-11 13:20 ` Tino Calancha
2017-08-11 13:25 ` Itai Berli
2017-08-11 14:18 ` Eli Zaretskii
1 sibling, 1 reply; 42+ messages in thread
From: Tino Calancha @ 2017-08-11 13:20 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers
On Fri, 11 Aug 2017, Itai Berli wrote:
> And what is the difference between gdb and gud-gdb?
I just catched this comment in the source code right before gud-gdb:
;; The old gdb command (text command mode). The new one is in gdb-mi.el.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 13:20 ` Tino Calancha
@ 2017-08-11 13:25 ` Itai Berli
0 siblings, 0 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-11 13:25 UTC (permalink / raw)
To: Tino Calancha; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Sorry, I don't get it.
On Fri, Aug 11, 2017 at 4:20 PM, Tino Calancha <tino.calancha@gmail.com>
wrote:
>
>
> On Fri, 11 Aug 2017, Itai Berli wrote:
>
> And what is the difference between gdb and gud-gdb?
>>
> I just catched this comment in the source code right before gud-gdb:
> ;; The old gdb command (text command mode). The new one is in gdb-mi.el.
>
>
[-- Attachment #2: Type: text/html, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 13:17 ` Itai Berli
2017-08-11 13:20 ` Tino Calancha
@ 2017-08-11 14:18 ` Eli Zaretskii
2017-08-11 14:42 ` Itai Berli
1 sibling, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 14:18 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel, tino.calancha
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 16:17:12 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> And what is the difference between gdb and gud-gdb?
They invoke 2 different interfaces between Emacs and GDB. Depending
on what version of GDB you have there, "M-x gdb" might not be the best
choice, because it needs GDB 7.0 or later.
There's also this comment in gdb-mi.el, which is what "M-x gdb" uses:
;;; macOS:
;; GDB in Emacs on macOS works best with FSF GDB as Apple have made
;; some changes to the version that they include as part of macOS.
;; This requires GDB version 7.0 or later as earlier versions do not
;; compile on macOS.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 14:18 ` Eli Zaretskii
@ 2017-08-11 14:42 ` Itai Berli
2017-08-11 15:08 ` Eli Zaretskii
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 14:42 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers, Tino Calancha
[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]
I have GDB 8.0, so it should work well, right? It appears, though, that
there are fewer buttons in the debug toolbar when the debugger is started
with gdb than when it is started with gud-gdb.
Eli, which function is the entry point for the bidi module? Where should I
set a breakpoint for starters?
On Fri, Aug 11, 2017 at 5:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Fri, 11 Aug 2017 16:17:12 +0300
> > Cc: Emacs developers <emacs-devel@gnu.org>
> >
> > And what is the difference between gdb and gud-gdb?
>
> They invoke 2 different interfaces between Emacs and GDB. Depending
> on what version of GDB you have there, "M-x gdb" might not be the best
> choice, because it needs GDB 7.0 or later.
>
> There's also this comment in gdb-mi.el, which is what "M-x gdb" uses:
>
> ;;; macOS:
>
> ;; GDB in Emacs on macOS works best with FSF GDB as Apple have made
> ;; some changes to the version that they include as part of macOS.
> ;; This requires GDB version 7.0 or later as earlier versions do not
> ;; compile on macOS.
>
[-- Attachment #2: Type: text/html, Size: 1620 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 14:42 ` Itai Berli
@ 2017-08-11 15:08 ` Eli Zaretskii
2017-08-11 15:34 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 15:08 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel, tino.calancha
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 17:42:25 +0300
> Cc: Tino Calancha <tino.calancha@gmail.com>, Emacs developers <emacs-devel@gnu.org>
>
> I have GDB 8.0, so it should work well, right? It appears, though, that there are fewer buttons in the debug
> toolbar when the debugger is started with gdb than when it is started with gud-gdb.
Try "M-x gdb-many-windows RET", maybe you will like the result.
> Eli, which function is the entry point for the bidi module? Where should I set a breakpoint for starters?
The entry point is bidi_get_next_char_visually. (See the beginning of
bidi.c for this and other information.)
However, setting a simple breakpoint there will cause that breakpoint
be hit all the time, and will therefore be useless. Tell me what you
want to do and with what text, and then I might be able to help you do
that in a more useful way.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 15:08 ` Eli Zaretskii
@ 2017-08-11 15:34 ` Itai Berli
2017-08-11 16:07 ` Itai Berli
2017-08-11 16:08 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-11 15:34 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]
> Tell me what you want to do and with what text, and then I might be able
to help you do
that in a more useful way.
I just want to get more familiar with the bidi algorithm and the way it is
implemented by Emacs. I'd like to try various small phrases, such as the
ones that can be found in this article: https://www.w3.org/In
ternational/articles/inline-bidi-markup/uba-basics
On Fri, Aug 11, 2017 at 6:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Fri, 11 Aug 2017 17:42:25 +0300
> > Cc: Tino Calancha <tino.calancha@gmail.com>, Emacs developers <
> emacs-devel@gnu.org>
> >
> > I have GDB 8.0, so it should work well, right? It appears, though, that
> there are fewer buttons in the debug
> > toolbar when the debugger is started with gdb than when it is started
> with gud-gdb.
>
> Try "M-x gdb-many-windows RET", maybe you will like the result.
>
> > Eli, which function is the entry point for the bidi module? Where should
> I set a breakpoint for starters?
>
> The entry point is bidi_get_next_char_visually. (See the beginning of
> bidi.c for this and other information.)
>
> However, setting a simple breakpoint there will cause that breakpoint
> be hit all the time, and will therefore be useless. Tell me what you
> want to do and with what text, and then I might be able to help you do
> that in a more useful way.
>
>
[-- Attachment #2: Type: text/html, Size: 2279 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 15:34 ` Itai Berli
@ 2017-08-11 16:07 ` Itai Berli
2017-08-11 16:08 ` Eli Zaretskii
1 sibling, 0 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-11 16:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]
It looks like after the main process starts spawning threads, it is
impossible to set breakpoints anymore.
On Fri, Aug 11, 2017 at 6:34 PM, Itai Berli <itai.berli@gmail.com> wrote:
> > Tell me what you want to do and with what text, and then I might be
> able to help you do
> that in a more useful way.
>
> I just want to get more familiar with the bidi algorithm and the way it is
> implemented by Emacs. I'd like to try various small phrases, such as the
> ones that can be found in this article: https://www.w3.org/In
> ternational/articles/inline-bidi-markup/uba-basics
>
> On Fri, Aug 11, 2017 at 6:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Itai Berli <itai.berli@gmail.com>
>> > Date: Fri, 11 Aug 2017 17:42:25 +0300
>> > Cc: Tino Calancha <tino.calancha@gmail.com>, Emacs developers <
>> emacs-devel@gnu.org>
>> >
>> > I have GDB 8.0, so it should work well, right? It appears, though, that
>> there are fewer buttons in the debug
>> > toolbar when the debugger is started with gdb than when it is started
>> with gud-gdb.
>>
>> Try "M-x gdb-many-windows RET", maybe you will like the result.
>>
>> > Eli, which function is the entry point for the bidi module? Where
>> should I set a breakpoint for starters?
>>
>> The entry point is bidi_get_next_char_visually. (See the beginning of
>> bidi.c for this and other information.)
>>
>> However, setting a simple breakpoint there will cause that breakpoint
>> be hit all the time, and will therefore be useless. Tell me what you
>> want to do and with what text, and then I might be able to help you do
>> that in a more useful way.
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 2812 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 15:34 ` Itai Berli
2017-08-11 16:07 ` Itai Berli
@ 2017-08-11 16:08 ` Eli Zaretskii
2017-08-11 17:32 ` Itai Berli
1 sibling, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-11 16:08 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 11 Aug 2017 18:34:08 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> > Tell me what you want to do and with what text, and then I might be able to help you do
> that in a more useful way.
>
> I just want to get more familiar with the bidi algorithm and the way it is implemented by Emacs. I'd like to try
> various small phrases, such as the ones that can be found in this article:
> https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
After entering GDB, set a breakpoint in a function called
Fredraw_display, then run Emacs ("run -Q"). Insert the text you want,
then move point to its beginning and type "C-x =". Remember the
buffer position displayed as result, let's call it POS.
Then type "M-x redraw-display RET". GDB will get control, and you can
now put breakpoints where you want. For tracing through the bidi.c
code, I'd suggest this:
(gdb) break bidi_get_next_char_visually if bidi_it->charpos == POS
(gdb) continue
When the breakpoint in bidi_get_next_char_visually breaks, you can
step through the code using the "step" and "next" commands (you have
tool-bar buttons for them).
Note that bidi_get_next_char_visually is called for each character the
display engine wants to display, so when it returns, it puts in
bidi_it->charpos the position of the next character in visual order.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 16:08 ` Eli Zaretskii
@ 2017-08-11 17:32 ` Itai Berli
2017-08-12 9:53 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-11 17:32 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]
Thank you, Eli.
On Fri, Aug 11, 2017 at 7:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Fri, 11 Aug 2017 18:34:08 +0300
> > Cc: Emacs developers <emacs-devel@gnu.org>
> >
> > > Tell me what you want to do and with what text, and then I might be
> able to help you do
> > that in a more useful way.
> >
> > I just want to get more familiar with the bidi algorithm and the way it
> is implemented by Emacs. I'd like to try
> > various small phrases, such as the ones that can be found in this
> article:
> > https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
>
> After entering GDB, set a breakpoint in a function called
> Fredraw_display, then run Emacs ("run -Q"). Insert the text you want,
> then move point to its beginning and type "C-x =". Remember the
> buffer position displayed as result, let's call it POS.
>
> Then type "M-x redraw-display RET". GDB will get control, and you can
> now put breakpoints where you want. For tracing through the bidi.c
> code, I'd suggest this:
>
> (gdb) break bidi_get_next_char_visually if bidi_it->charpos == POS
> (gdb) continue
>
> When the breakpoint in bidi_get_next_char_visually breaks, you can
> step through the code using the "step" and "next" commands (you have
> tool-bar buttons for them).
>
> Note that bidi_get_next_char_visually is called for each character the
> display engine wants to display, so when it returns, it puts in
> bidi_it->charpos the position of the next character in visual order.
>
[-- Attachment #2: Type: text/html, Size: 2267 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-11 17:32 ` Itai Berli
@ 2017-08-12 9:53 ` Itai Berli
2017-08-12 10:20 ` Eli Zaretskii
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-12 9:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]
If I make a change to the code, for experimentation purposes, how do I
compile it so I can see my change in action and debug it? Should I run
./autogen.sh
./autogen.sh git
CFLAGS='-O0 -g3' ./configure
make
make install
or can I simply compile the file that I changed with the compiler (GCC or
Clang)?
On Fri, Aug 11, 2017 at 8:32 PM, Itai Berli <itai.berli@gmail.com> wrote:
> Thank you, Eli.
>
> On Fri, Aug 11, 2017 at 7:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Itai Berli <itai.berli@gmail.com>
>> > Date: Fri, 11 Aug 2017 18:34:08 +0300
>> > Cc: Emacs developers <emacs-devel@gnu.org>
>> >
>> > > Tell me what you want to do and with what text, and then I might be
>> able to help you do
>> > that in a more useful way.
>> >
>> > I just want to get more familiar with the bidi algorithm and the way it
>> is implemented by Emacs. I'd like to try
>> > various small phrases, such as the ones that can be found in this
>> article:
>> > https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
>>
>> After entering GDB, set a breakpoint in a function called
>> Fredraw_display, then run Emacs ("run -Q"). Insert the text you want,
>> then move point to its beginning and type "C-x =". Remember the
>> buffer position displayed as result, let's call it POS.
>>
>> Then type "M-x redraw-display RET". GDB will get control, and you can
>> now put breakpoints where you want. For tracing through the bidi.c
>> code, I'd suggest this:
>>
>> (gdb) break bidi_get_next_char_visually if bidi_it->charpos == POS
>> (gdb) continue
>>
>> When the breakpoint in bidi_get_next_char_visually breaks, you can
>> step through the code using the "step" and "next" commands (you have
>> tool-bar buttons for them).
>>
>> Note that bidi_get_next_char_visually is called for each character the
>> display engine wants to display, so when it returns, it puts in
>> bidi_it->charpos the position of the next character in visual order.
>>
>
>
[-- Attachment #2: Type: text/html, Size: 3227 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 9:53 ` Itai Berli
@ 2017-08-12 10:20 ` Eli Zaretskii
2017-08-12 10:43 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-12 10:20 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Sat, 12 Aug 2017 12:53:24 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> If I make a change to the code, for experimentation purposes, how do I compile it so I can see my change in
> action and debug it? Should I run
>
> ./autogen.sh
> ./autogen.sh git
> CFLAGS='-O0 -g3' ./configure
> make
> make install
>
> or can I simply compile the file that I changed with the compiler (GCC or Clang)?
Just "make" should do. Since you are debugging the binary in the
source tree, not the installed binary, "make install" shouldn't be
necessary, AFAIU (but I don't know enough about the intricacies of
macOS installations).
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 10:20 ` Eli Zaretskii
@ 2017-08-12 10:43 ` Itai Berli
2017-08-12 11:43 ` Tino Calancha
2017-08-12 11:57 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-12 10:43 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]
Thanks. A new executable appeared in the src folder: emacs-26.0.50.2
Is this the executable that I need to run to see the changes I made, or can
I still run emacs-26.0.50.1?
Generally speaking, whenever I make a change and rebuild, do I need to
change the target file that I run (emacs-26.0.50.2, .3, .4, etc.)?
On Sat, Aug 12, 2017 at 1:20 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Sat, 12 Aug 2017 12:53:24 +0300
> > Cc: Emacs developers <emacs-devel@gnu.org>
> >
> > If I make a change to the code, for experimentation purposes, how do I
> compile it so I can see my change in
> > action and debug it? Should I run
> >
> > ./autogen.sh
> > ./autogen.sh git
> > CFLAGS='-O0 -g3' ./configure
> > make
> > make install
> >
> > or can I simply compile the file that I changed with the compiler (GCC
> or Clang)?
>
> Just "make" should do. Since you are debugging the binary in the
> source tree, not the installed binary, "make install" shouldn't be
> necessary, AFAIU (but I don't know enough about the intricacies of
> macOS installations).
>
[-- Attachment #2: Type: text/html, Size: 1693 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 10:43 ` Itai Berli
@ 2017-08-12 11:43 ` Tino Calancha
2017-08-12 11:59 ` Stephen Berman
2017-08-12 11:57 ` Eli Zaretskii
1 sibling, 1 reply; 42+ messages in thread
From: Tino Calancha @ 2017-08-12 11:43 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers
On Sat, 12 Aug 2017, Itai Berli wrote:
> Thanks. A new executable appeared in the src folder: emacs-26.0.50.2Is this the executable that I need to run to see the changes
> I made?
Yes, that one.
> Generally speaking, whenever I make a change and rebuild, do I need to change the target file that I run (emacs-26.0.50.2, .3,
> .4, etc.)?
Yes, if you don't have bootstrap-emacs.
In my sistem running GNU/Linux, everytime i rebuild i get:
*) emacs-26.0.50.N (N=1,2,3, ...)
*) i also get the file bootstrap-emacs; this file is overwritten after
every compilation. I always chose bootstrap-emacs as the executable to
compile.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 10:43 ` Itai Berli
2017-08-12 11:43 ` Tino Calancha
@ 2017-08-12 11:57 ` Eli Zaretskii
1 sibling, 0 replies; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-12 11:57 UTC (permalink / raw)
To: Itai Berli; +Cc: emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Sat, 12 Aug 2017 13:43:18 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>
>
> Thanks. A new executable appeared in the src folder: emacs-26.0.50.2
And 'emacs' should be hard-linked to this new executable.
> Is this the executable that I need to run to see the changes I made, or can I still run emacs-26.0.50.1?
Neither. You call 'emacs', which is hard-linked to the latest
emacs-26.0.50.N executable. The numbered executables are there for
you to be able to invoke previous versions.
> Generally speaking, whenever I make a change and rebuild, do I need to change the target file that I run
> (emacs-26.0.50.2, .3, .4, etc.)?
Not if your target is always 'emacs'.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 11:43 ` Tino Calancha
@ 2017-08-12 11:59 ` Stephen Berman
2017-08-12 12:08 ` Itai Berli
0 siblings, 1 reply; 42+ messages in thread
From: Stephen Berman @ 2017-08-12 11:59 UTC (permalink / raw)
To: Tino Calancha; +Cc: Itai Berli, Emacs developers
On Sat, 12 Aug 2017 20:43:58 +0900 (JST) Tino Calancha <tino.calancha@gmail.com> wrote:
> On Sat, 12 Aug 2017, Itai Berli wrote:
>
>> Thanks. A new executable appeared in the src folder: emacs-26.0.50.2Is this
>> the executable that I need to run to see the changes
>> I made?
> Yes, that one.
>> Generally speaking, whenever I make a change and rebuild, do I need to
>> change the target file that I run (emacs-26.0.50.2, .3,
>> .4, etc.)?
> Yes, if you don't have bootstrap-emacs.
> In my sistem running GNU/Linux, everytime i rebuild i get: *) emacs-26.0.50.N
> (N=1,2,3, ...)
> *) i also get the file bootstrap-emacs; this file is overwritten after
> every compilation. I always chose bootstrap-emacs as the executable to
> compile.
IIUC, on GNU/Linux bootstrap-emacs is a hard link to the latest
executable, and there should also be another hard link called simply
emacs; that's what I execute when I want the most recent built
executable. I don't know if other platforms also have this setup.
Steve Berman
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 11:59 ` Stephen Berman
@ 2017-08-12 12:08 ` Itai Berli
2017-08-12 12:14 ` Stephen Berman
2017-08-12 12:15 ` Eli Zaretskii
0 siblings, 2 replies; 42+ messages in thread
From: Itai Berli @ 2017-08-12 12:08 UTC (permalink / raw)
To: Stephen Berman; +Cc: Emacs developers, Tino Calancha
[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]
Thanks, everyone. What's the difference between emacs and bootstrap-emacs?
On Sat, Aug 12, 2017 at 2:59 PM, Stephen Berman <stephen.berman@gmx.net>
wrote:
> On Sat, 12 Aug 2017 20:43:58 +0900 (JST) Tino Calancha <
> tino.calancha@gmail.com> wrote:
>
> > On Sat, 12 Aug 2017, Itai Berli wrote:
> >
> >> Thanks. A new executable appeared in the src folder: emacs-26.0.50.2Is
> this
> >> the executable that I need to run to see the changes
> >> I made?
> > Yes, that one.
> >> Generally speaking, whenever I make a change and rebuild, do I need to
> >> change the target file that I run (emacs-26.0.50.2, .3,
> >> .4, etc.)?
> > Yes, if you don't have bootstrap-emacs.
> > In my sistem running GNU/Linux, everytime i rebuild i get: *)
> emacs-26.0.50.N
> > (N=1,2,3, ...)
> > *) i also get the file bootstrap-emacs; this file is overwritten after
> > every compilation. I always chose bootstrap-emacs as the executable
> to
> > compile.
>
> IIUC, on GNU/Linux bootstrap-emacs is a hard link to the latest
> executable, and there should also be another hard link called simply
> emacs; that's what I execute when I want the most recent built
> executable. I don't know if other platforms also have this setup.
>
> Steve Berman
>
[-- Attachment #2: Type: text/html, Size: 1781 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 12:08 ` Itai Berli
@ 2017-08-12 12:14 ` Stephen Berman
2017-08-12 12:15 ` Eli Zaretskii
1 sibling, 0 replies; 42+ messages in thread
From: Stephen Berman @ 2017-08-12 12:14 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers, Tino Calancha
On Sat, 12 Aug 2017 15:08:53 +0300 Itai Berli <itai.berli@gmail.com> wrote:
> Thanks, everyone. What's the difference between emacs and bootstrap-emacs?
If your system has both, there should be no difference; hard links are
basically different names for the same file.
Steve Berman
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 12:08 ` Itai Berli
2017-08-12 12:14 ` Stephen Berman
@ 2017-08-12 12:15 ` Eli Zaretskii
2017-08-12 13:28 ` Itai Berli
1 sibling, 1 reply; 42+ messages in thread
From: Eli Zaretskii @ 2017-08-12 12:15 UTC (permalink / raw)
To: Itai Berli; +Cc: stephen.berman, tino.calancha, emacs-devel
> From: Itai Berli <itai.berli@gmail.com>
> Date: Sat, 12 Aug 2017 15:08:53 +0300
> Cc: Emacs developers <emacs-devel@gnu.org>,
> Tino Calancha <tino.calancha@gmail.com>
>
> What's the difference between emacs and bootstrap-emacs?
Normally, none. They are only different during a bootstrap build:
bootstrap-emacs has the Lisp files in source form, before they were
byte-compiled.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 12:15 ` Eli Zaretskii
@ 2017-08-12 13:28 ` Itai Berli
2017-08-12 13:47 ` Tino Calancha
0 siblings, 1 reply; 42+ messages in thread
From: Itai Berli @ 2017-08-12 13:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Stephen Berman, Emacs developers, Tino Calancha
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
By the way, forgive this ignorant question, but is the Emacs source code
written in C or in C++?
On Sat, Aug 12, 2017 at 3:15 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Itai Berli <itai.berli@gmail.com>
> > Date: Sat, 12 Aug 2017 15:08:53 +0300
> > Cc: Emacs developers <emacs-devel@gnu.org>,
> > Tino Calancha <tino.calancha@gmail.com>
> >
> > What's the difference between emacs and bootstrap-emacs?
>
> Normally, none. They are only different during a bootstrap build:
> bootstrap-emacs has the Lisp files in source form, before they were
> byte-compiled.
>
>
[-- Attachment #2: Type: text/html, Size: 1094 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 13:28 ` Itai Berli
@ 2017-08-12 13:47 ` Tino Calancha
2017-08-12 14:20 ` Anders Lindgren
0 siblings, 1 reply; 42+ messages in thread
From: Tino Calancha @ 2017-08-12 13:47 UTC (permalink / raw)
To: Itai Berli; +Cc: Emacs developers
On Sat, 12 Aug 2017, Itai Berli wrote:
> By the way, forgive this ignorant question, but is the Emacs source code written in C or in C++?
No C++.
Some part is written in C, the rest in elisp.
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: Help getting started debugging Emacs on macOS Sierra
2017-08-12 13:47 ` Tino Calancha
@ 2017-08-12 14:20 ` Anders Lindgren
0 siblings, 0 replies; 42+ messages in thread
From: Anders Lindgren @ 2017-08-12 14:20 UTC (permalink / raw)
To: Tino Calancha; +Cc: Itai Berli, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
On Sat, Aug 12, 2017 at 3:47 PM, Tino Calancha <tino.calancha@gmail.com>
wrote:
>
>
> On Sat, 12 Aug 2017, Itai Berli wrote:
>
> By the way, forgive this ignorant question, but is the Emacs source code
>> written in C or in C++?
>>
> No C++.
> Some part is written in C, the rest in elisp.
>
>
And, for macOS, some are written in Objective-C.
-- Anders
[-- Attachment #2: Type: text/html, Size: 898 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2017-08-12 14:20 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-10 23:25 Help getting started debugging Emacs on macOS Sierra Itai Berli
2017-08-11 3:04 ` Paul Eggert
2017-08-11 5:06 ` Itai Berli
2017-08-11 8:47 ` Paul Eggert
2017-08-11 8:57 ` Itai Berli
2017-08-11 9:27 ` Itai Berli
2017-08-11 9:52 ` Eli Zaretskii
2017-08-11 9:55 ` Itai Berli
2017-08-11 9:59 ` Itai Berli
2017-08-11 10:09 ` Itai Berli
2017-08-11 11:46 ` Tino Calancha
2017-08-11 12:14 ` Itai Berli
2017-08-11 12:33 ` Tino Calancha
2017-08-11 12:40 ` Itai Berli
2017-08-11 12:48 ` Tino Calancha
2017-08-11 13:17 ` Itai Berli
2017-08-11 13:20 ` Tino Calancha
2017-08-11 13:25 ` Itai Berli
2017-08-11 14:18 ` Eli Zaretskii
2017-08-11 14:42 ` Itai Berli
2017-08-11 15:08 ` Eli Zaretskii
2017-08-11 15:34 ` Itai Berli
2017-08-11 16:07 ` Itai Berli
2017-08-11 16:08 ` Eli Zaretskii
2017-08-11 17:32 ` Itai Berli
2017-08-12 9:53 ` Itai Berli
2017-08-12 10:20 ` Eli Zaretskii
2017-08-12 10:43 ` Itai Berli
2017-08-12 11:43 ` Tino Calancha
2017-08-12 11:59 ` Stephen Berman
2017-08-12 12:08 ` Itai Berli
2017-08-12 12:14 ` Stephen Berman
2017-08-12 12:15 ` Eli Zaretskii
2017-08-12 13:28 ` Itai Berli
2017-08-12 13:47 ` Tino Calancha
2017-08-12 14:20 ` Anders Lindgren
2017-08-12 11:57 ` Eli Zaretskii
2017-08-11 12:43 ` Eli Zaretskii
2017-08-11 9:35 ` Eli Zaretskii
2017-08-11 6:28 ` Eli Zaretskii
2017-08-11 8:27 ` Itai Berli
2017-08-11 9:30 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).