Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Reporting of "program no longer exists"
@ 2006-10-14 16:33 Vladimir Prus
  2006-10-14 16:39 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2006-10-14 16:33 UTC (permalink / raw)
  To: gdb


Hi,
suppose a program being debugged got SIGSEGV and the user for GUI frontend 
tries the "next" command. Here's what happens:

   (gdb) -exec-next
   ^running
   *stopped,reason="signal-received",signal-name="SIGSEGV".....
   (gdb) -exec-next
   ^running
   Couldn't get registers: No such process.
   ^error,msg="Couldn't get registers: No such process."

I think this is a bit unfriendly to frontend.

(1) How can frontend disable the "next" command? Checking for "SIGSEGV" is 
possible, but it a bit of a hack.

(2) After getting the second response, how can frontend understand that this 
is really fatal, unfixable error? Looking at the specific text is obviously a 
hack?

How about making a notion of "inferior state" and announcing changes in the 
state. So, the above would become

   (gdb) -exec-next
   ^running
   *stopped,target-state="noncontinuable",
           reason="signal-received",signal-name="SIGSEGV".....
   (gdb) -exec-next
   ^running
   Couldn't get registers: No such process.
   ^error,msg="Couldn't get registers: No such process.",target-state="dead"

?

- Volodya


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

* Re: Reporting of "program no longer exists"
  2006-10-14 16:33 Reporting of "program no longer exists" Vladimir Prus
@ 2006-10-14 16:39 ` Daniel Jacobowitz
  2006-10-14 20:58   ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-10-14 16:39 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

On Sat, Oct 14, 2006 at 08:33:16PM +0400, Vladimir Prus wrote:
> 
> Hi,
> suppose a program being debugged got SIGSEGV and the user for GUI frontend 
> tries the "next" command. Here's what happens:
> 
>    (gdb) -exec-next
>    ^running
>    *stopped,reason="signal-received",signal-name="SIGSEGV".....
>    (gdb) -exec-next
>    ^running
>    Couldn't get registers: No such process.
>    ^error,msg="Couldn't get registers: No such process."

This is simply a bug.  Try it from the CLI:

(gdb) r
Starting program: /bin/cat
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)

Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaac7f352 in __read_nocancel () from /lib/libc.so.6
(gdb) n
Single stepping until exit from function __read_nocancel, 
which has no line number information.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) 

-exec-next ought to report ^running and then that the program has
exited (is that ^exited?).  So I'd look at where the error came from.

> (1) How can frontend disable the "next" command? Checking for "SIGSEGV" is 
> possible, but it a bit of a hack.

It's wrong.  We don't know yet that the SIGSEGV will be fatal.  If the
application has a signal handler installed for SIGSEGV, when you
continue the handler will be executed, and life will go on.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Reporting of "program no longer exists"
  2006-10-14 16:39 ` Daniel Jacobowitz
@ 2006-10-14 20:58   ` Nick Roberts
  2006-10-14 21:05     ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2006-10-14 20:58 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Vladimir Prus, gdb

 > >    (gdb) -exec-next
 > >    ^running
 > >    *stopped,reason="signal-received",signal-name="SIGSEGV".....
 > >    (gdb) -exec-next
 > >    ^running
 > >    Couldn't get registers: No such process.
 > >    ^error,msg="Couldn't get registers: No such process."
 > 
 > This is simply a bug.  Try it from the CLI:
 > ...

I frequently encounter this bug from the CLI when debugging Emacs, so I don't
think its an MI problem.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Reporting of "program no longer exists"
  2006-10-14 20:58   ` Nick Roberts
@ 2006-10-14 21:05     ` Daniel Jacobowitz
  2006-10-14 21:17       ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-10-14 21:05 UTC (permalink / raw)
  To: Nick Roberts; +Cc: Vladimir Prus, gdb

On Sun, Oct 15, 2006 at 09:55:50AM +1300, Nick Roberts wrote:
>  > >    (gdb) -exec-next
>  > >    ^running
>  > >    *stopped,reason="signal-received",signal-name="SIGSEGV".....
>  > >    (gdb) -exec-next
>  > >    ^running
>  > >    Couldn't get registers: No such process.
>  > >    ^error,msg="Couldn't get registers: No such process."
>  > 
>  > This is simply a bug.  Try it from the CLI:
>  > ...
> 
> I frequently encounter this bug from the CLI when debugging Emacs, so I don't
> think its an MI problem.

That's definitely possible, though I've only ever seen it with threads;
in any case, wherever it appears, we should fix it.  Losing track of
the inferior this way is just silly.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Reporting of "program no longer exists"
  2006-10-14 21:05     ` Daniel Jacobowitz
@ 2006-10-14 21:17       ` Nick Roberts
  2006-10-15  4:36         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2006-10-14 21:17 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Vladimir Prus, gdb

 > That's definitely possible, though I've only ever seen it with threads;
 > in any case, wherever it appears, we should fix it.  Losing track of
 > the inferior this way is just silly.

I think Emacs does use threads (I don't know why).  I also encounterd this
when trying to make GDB asynchronous.  I think it was because I got to
ptrace (PTRACE_CONT,...) twice.  The second encounter (and maybe the first)
being

  if (ptrace (request, pid, 0, target_signal_to_host (signal)) == -1)
    perror_with_name (("ptrace"));

in i386_linux_resume where it failed.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Reporting of "program no longer exists"
  2006-10-14 21:17       ` Nick Roberts
@ 2006-10-15  4:36         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2006-10-15  4:36 UTC (permalink / raw)
  To: Nick Roberts; +Cc: drow, ghost, gdb

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Sun, 15 Oct 2006 10:14:45 +1300
> Cc: Vladimir Prus <ghost@cs.msu.su>, gdb@sources.redhat.com
> 
> I think Emacs does use threads

Only on Windows, AFAIK.  But if some library (e.g., GTK) uses threads
internally, then it's possible on other platforms as well.


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

end of thread, other threads:[~2006-10-15  4:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-14 16:33 Reporting of "program no longer exists" Vladimir Prus
2006-10-14 16:39 ` Daniel Jacobowitz
2006-10-14 20:58   ` Nick Roberts
2006-10-14 21:05     ` Daniel Jacobowitz
2006-10-14 21:17       ` Nick Roberts
2006-10-15  4:36         ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox