all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* gdb debug core file?
@ 2016-05-04 14:58 stanton arch
  2016-05-04 17:38 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: stanton arch @ 2016-05-04 14:58 UTC (permalink / raw)
  To: help-gnu-emacs

How do you debug a core file with gdb under emacs now?

I'm using emacs 24.5.1 and I can't figure out invocation to debug core file.

My emacs is starting with "gdb -i=mi" now and it seems to work fine running  and debug some program:
 gdb -i=mi myprogram 

I've tried passing args and names to executable and core file various ways but haven't figured out correct way.

Thanks



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

* Re: gdb debug core file?
  2016-05-04 14:58 stanton arch
@ 2016-05-04 17:38 ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2016-05-04 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 4 May 2016 10:58:49 -0400
> From: stanton arch <stanton_arch@mail.com>
> 
> How do you debug a core file with gdb under emacs now?
> 
> I'm using emacs 24.5.1 and I can't figure out invocation to debug core file.
> 
> My emacs is starting with "gdb -i=mi" now and it seems to work fine running  and debug some program:
>  gdb -i=mi myprogram 
> 
> I've tried passing args and names to executable and core file various ways but haven't figured out correct way.

  gdb -i=mi --core=CORE-FILE myprogram

or

  gdb -i=mi myprogram CORE-FILE




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

* Re: gdb debug core file?
@ 2016-05-04 21:52 stanton arch
  0 siblings, 0 replies; 5+ messages in thread
From: stanton arch @ 2016-05-04 21:52 UTC (permalink / raw)
  To: help-gnu-emacs

Hmmm, I tried that but I can't see the backtrace for some reason
inside of emacs, but in a normal shell is fine.

If I do from shell:
> gdb myprog myprog.core
[snipped...]
Type "apropos word" to search for commands related to "word"...
Reading symbols from myprog...done.

[New process 1]
Core was generated by `myprog'.
Program terminated with signal SIGABRT, Aborted.
#0  0xbb1bfed7 in _lwp_kill () from /usr/lib/libc.so.12
(gdb) bt
#0  0xbb1bfed7 in _lwp_kill () from /usr/lib/libc.so.12
#1  0xbb1bfe78 in raise () from /usr/lib/libc.so.12
#2  0xbb1bfa92 in abort () from /usr/lib/libc.so.12
...

but inside of emacs I get:
 gdb -i=mi --core=./myprog.core ./myprog
[snipped...]
Reading symbols from myprog...done.

[New process 1]
Core was generated by `myprog'.
Program terminated with signal SIGABRT, Aborted.
(gdb) bt
Invalid selected thread.
(gdb)

It is only this particular program I seem to have issues, a simple
hello_world.c works fine in emacs and shell.

Is there some gdb command I need to run inside of emacs first to view
backtrace, or any other ideas?

Thanks




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

* Re: gdb debug core file?
@ 2016-05-05 14:49 stanton arch
  2016-05-05 16:10 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: stanton arch @ 2016-05-05 14:49 UTC (permalink / raw)
  To: help-gnu-emacs

The program I was trying to debug is threaded, and I found that if I
do an "info threads" inside of gdb then I can't view the backtrace of
the corefile anymore, even running outside of emacs:

 Program terminated with signal SIGABRT, Aborted.
 #0  0xbb1bfed7 in _lwp_kill () from /usr/lib/libc.so.12
 (gdb) info threads
 No threads.
 (gdb) bt
 Invalid selected thread.
 (gdb)
 
So I guess that is what the emacs gdb interface is doing and there is
some bug in gdb.  I also tried viewing switching proc, thread, and
inferior to no avail.

My workaround was to put an abort() call somewhere in program being
debugged, and then run gdb/emacs interface which allows me to inspect
aborted program.

Thanks



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

* Re: gdb debug core file?
  2016-05-05 14:49 stanton arch
@ 2016-05-05 16:10 ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2016-05-05 16:10 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 5 May 2016 10:49:51 -0400
> From: stanton arch <stanton_arch@mail.com>
> 
> The program I was trying to debug is threaded, and I found that if I
> do an "info threads" inside of gdb then I can't view the backtrace of
> the corefile anymore, even running outside of emacs:
> 
>  Program terminated with signal SIGABRT, Aborted.
>  #0  0xbb1bfed7 in _lwp_kill () from /usr/lib/libc.so.12
>  (gdb) info threads
>  No threads.
>  (gdb) bt
>  Invalid selected thread.
>  (gdb)

What version of GDB is that?  If it's the latest, perhaps you should
report this to the GDB mailing list, where you will have the
definitive answer about whether this is a GDB or Emacs bug.

Thanks.



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

end of thread, other threads:[~2016-05-05 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 21:52 gdb debug core file? stanton arch
  -- strict thread matches above, loose matches on Subject: below --
2016-05-05 14:49 stanton arch
2016-05-05 16:10 ` Eli Zaretskii
2016-05-04 14:58 stanton arch
2016-05-04 17:38 ` Eli Zaretskii

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.