all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to build Emacs with debugging information?
@ 2015-01-24 15:43 Oleh
  2015-01-24 17:10 ` Alan Mackenzie
  0 siblings, 1 reply; 4+ messages in thread
From: Oleh @ 2015-01-24 15:43 UTC (permalink / raw)
  To: emacs-devel

Hi all,

Sorry if I'm asking obvious things, I'm not too experienced with C.

I wanted to step through `scan_lists' from syntax.c to understand why
and how "<" and ">" are matched in `c++-mode'. For example, they won't
be matched here, calling `forward-list':

    #include <vector>

but will be matched here:

    vector<int> foo;

Anyway, stepping with gdb, inside another Emacs instance, I see that
many values are "<optimized out>", e.g.

    (gdb) p found
    $1 = <optimized out>

Normally I would pass "-g -O0" flags to gcc to solve this for the
C/C++ programs that I write. How can I do the equivalent thing for
Emacs? Is there a way to have both the "debug" and "release"
configurations for the Emacs executable?

regards,
Oleh



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to build Emacs with debugging information?
  2015-01-24 15:43 How to build Emacs with debugging information? Oleh
@ 2015-01-24 17:10 ` Alan Mackenzie
  2015-01-24 18:13   ` Óscar Fuentes
  2015-01-24 20:52   ` Oleh
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Mackenzie @ 2015-01-24 17:10 UTC (permalink / raw)
  To: Oleh; +Cc: emacs-devel

Hello, Oleh.

On Sat, Jan 24, 2015 at 04:43:57PM +0100, Oleh wrote:
> Hi all,

> Sorry if I'm asking obvious things, I'm not too experienced with C.

> I wanted to step through `scan_lists' from syntax.c to understand why
> and how "<" and ">" are matched in `c++-mode'. For example, they won't
> be matched here, calling `forward-list':

>     #include <vector>

> but will be matched here:

>     vector<int> foo;

What exactly do you want here?  Do you really just want to know the
answer to your question about scanning "<" and ">", or do you
specifically want to find it out yourself with the debugger?  If it's the
first of these, I can tell you.  ;-)

If it's the second of these, ....

> Anyway, stepping with gdb, inside another Emacs instance, I see that
> many values are "<optimized out>", e.g.

>     (gdb) p found
>     $1 = <optimized out>

> Normally I would pass "-g -O0" flags to gcc to solve this for the
> C/C++ programs that I write. How can I do the equivalent thing for
> Emacs?

You'll need to reconfigure and rebuild Emacs.  If you're on a GNU or
other Unix-like system, do something like:

    $ CFLAGS='-g3 -O0' ./configure <other arguments>

, then call make in the usual way.  (If you're on a different OS, such as
Microsoft Windows, then I can't help you here, but somebody else will.)

> Is there a way to have both the "debug" and "release" configurations
> for the Emacs executable?

I'm not sure what you mean by "configurations", but you can have two
Emacs executables side by side.  (Again, on GNU etc.,) when you build
Emacs, the executable is called something like emacs-25.0.50.4, where the
4 is incremented each time you build.  The last build is hard linked to
the file emacs.  So you just have the hassle of typing in "-25.0.50.4"
when you start the "release" version.

> regards,
> Oleh

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to build Emacs with debugging information?
  2015-01-24 17:10 ` Alan Mackenzie
@ 2015-01-24 18:13   ` Óscar Fuentes
  2015-01-24 20:52   ` Oleh
  1 sibling, 0 replies; 4+ messages in thread
From: Óscar Fuentes @ 2015-01-24 18:13 UTC (permalink / raw)
  To: emacs-devel

Alan Mackenzie <acm@muc.de> writes:

>> Normally I would pass "-g -O0" flags to gcc to solve this for the
>> C/C++ programs that I write. How can I do the equivalent thing for
>> Emacs?
>
> You'll need to reconfigure and rebuild Emacs.  If you're on a GNU or
> other Unix-like system, do something like:
>
>     $ CFLAGS='-g3 -O0' ./configure <other arguments>
>
> , then call make in the usual way.  (If you're on a different OS, such as
> Microsoft Windows, then I can't help you here, but somebody else will.)

Same on Windows.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to build Emacs with debugging information?
  2015-01-24 17:10 ` Alan Mackenzie
  2015-01-24 18:13   ` Óscar Fuentes
@ 2015-01-24 20:52   ` Oleh
  1 sibling, 0 replies; 4+ messages in thread
From: Oleh @ 2015-01-24 20:52 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> What exactly do you want here?  Do you really just want to know the
> answer to your question about scanning "<" and ">", or do you
> specifically want to find it out yourself with the debugger?  If it's the
> first of these, I can tell you.  ;-)

The second.

> If it's the second of these, ....
>
>> Anyway, stepping with gdb, inside another Emacs instance, I see that
>> many values are "<optimized out>", e.g.
>
>>     (gdb) p found
>>     $1 = <optimized out>
>
>> Normally I would pass "-g -O0" flags to gcc to solve this for the
>> C/C++ programs that I write. How can I do the equivalent thing for
>> Emacs?
>
> You'll need to reconfigure and rebuild Emacs.  If you're on a GNU or
> other Unix-like system, do something like:
>
>     $ CFLAGS='-g3 -O0' ./configure <other arguments>
>
> , then call make in the usual way.  (If you're on a different OS, such as
> Microsoft Windows, then I can't help you here, but somebody else will.)
>
>> Is there a way to have both the "debug" and "release" configurations
>> for the Emacs executable?
>
> I'm not sure what you mean by "configurations", but you can have two
> Emacs executables side by side.  (Again, on GNU etc.,) when you build
> Emacs, the executable is called something like emacs-25.0.50.4, where the
> 4 is incremented each time you build.  The last build is hard linked to
> the file emacs.  So you just have the hassle of typing in "-25.0.50.4"
> when you start the "release" version.

Thanks, it works just as I wanted. I simply renamed "emacs-25.0.50.2"
to "emacs-debug". Now I can inspect all the values.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-24 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-24 15:43 How to build Emacs with debugging information? Oleh
2015-01-24 17:10 ` Alan Mackenzie
2015-01-24 18:13   ` Óscar Fuentes
2015-01-24 20:52   ` Oleh

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.