Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to pop -c in gdb
@ 2007-01-10  0:51 William K. Foster
  2007-01-10  2:51 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: William K. Foster @ 2007-01-10  0:51 UTC (permalink / raw)
  To: gdb

Hello,

When I used dbx and at the prompt called a function which got a SEGV or 
something, I could do "pop -c" to recover from my call and return to the 
point I was at in the program being debugged where I typed in the 
expression that failed.

I would like to do the same in gdb, the closest I could find is the 
return command however the program being debugged can not continue.

-------------------------------------------------------------------------------------------------------------------------

Here is a sample session that shows this:

Breakpoint 11, snDesktop::openSchematicWindow (this=0x830e188, 
schDesign=0x46a5f792, newWindow=true, w=-1, h=-1) at snDesktop.cc:1928

(gdb) p window->x()
$26 = 0
(gdb) p window
$27 = (snSchemWindow *) 0x9fd3310
(gdb) p $27->x()
Reading in symbols for painting/qbackingstore.cpp...done.

Program received signal SIGSEGV, Segmentation fault.
0x42d05bda in QWidgetPrivate::q_func (this=0x0) at qwidget_p.h:157
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (QWidget::x() 
const) will be abandoned.
(gdb) where 9
#0  0x42d05bda in QWidgetPrivate::q_func (this=0x0) at qwidget_p.h:157
#1  0x42d03010 in QWidgetPrivate::frameStrut (this=0x0) at qwidget.cpp:8420
#2  0x42cf7fbf in QWidget::x (this=0x9fd3310) at qwidget.cpp:2614
#3  <function called from gdb>
#4  snDesktop::openSchematicWindow (this=0x830e188, 
schDesign=0x46a5f792, newWindow=true, w=-1, h=-1) at snDesktop.cc:1928
#5  0x42136caa in snDtLibBrowser::openView (this=0x831eae0, openMode=114 
'r', windowType=2) at snDtLibBrowser.cc:308
#6  0x421364ca in snDtLibBrowser::openDesign (this=0x831eae0, 
item=0x8889f10) at snDtLibBrowser.cc:178
#7  0x421d42b1 in snDtLibBrowser::qt_metacall (this=0x831eae0, 
_c=InvokeMetaMethod, _id=6, _a=0xbfffd970) at moc_snDtLibBrowser.cc:104
#8  0x4352681b in QMetaObject::activate (sender=0x831eae0, 
from_signal_index=58, to_signal_index=58, argv=0xbfffd970) at 
qobject.cpp:2938
(gdb) return
(gdb) return
(gdb) return
(gdb) where 9
#0  snDesktop::openSchematicWindow (this=0x830e188, 
schDesign=0x46a5f792, newWindow=true, w=-1, h=-1) at snDesktop.cc:1928
#1  0x42136caa in snDtLibBrowser::openView (this=0x831eae0, openMode=114 
'r', windowType=2) at snDtLibBrowser.cc:308
#2  0x421364ca in snDtLibBrowser::openDesign (this=0x831eae0, 
item=0x8889f10) at snDtLibBrowser.cc:178
#3  0x421d42b1 in snDtLibBrowser::qt_metacall (this=0x831eae0, 
_c=InvokeMetaMethod, _id=6, _a=0xbfffd970) at moc_snDtLibBrowser.cc:104
#4  0x4352681b in QMetaObject::activate (sender=0x831eae0, 
from_signal_index=58, to_signal_index=58, argv=0xbfffd970) at 
qobject.cpp:2938
#5  0x43526aaf in QMetaObject::activate (sender=0x831eae0, m=0x42a72218, 
local_signal_index=8, argv=0xbfffd970) at qobject.cpp:2981
#6  0x429d0025 in Q3ListView::doubleClicked (this=0x831eae0, 
_t1=0x8889f10, _t2=@0xbfffd9a8, _t3=0) at moc_q3listview.cpp:320
#7  0x42845248 in Q3ListView::contentsMouseDoubleClickEvent 
(this=0x831eae0, e=0xbfffd9f0) at q3listview.cpp:4515
#8  0x428b5019 in Q3ScrollView::viewportMouseDoubleClickEvent 
(this=0x831eae0, e=0xbfffdf10) at q3scrollview.cpp:1753
(gdb) fin

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

-------------------------------------------------------------------------------------------------------------------------

It seems gdb can not recover from the recursive error like dbx is able 
to do.

Thanks for your help.

-William


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

* Re: How to pop -c in gdb
  2007-01-10  0:51 How to pop -c in gdb William K. Foster
@ 2007-01-10  2:51 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2007-01-10  2:51 UTC (permalink / raw)
  To: William K. Foster; +Cc: gdb

On Tue, Jan 09, 2007 at 04:51:01PM -0800, William K. Foster wrote:
> Hello,
> 
> When I used dbx and at the prompt called a function which got a SEGV or 
> something, I could do "pop -c" to recover from my call and return to the 
> point I was at in the program being debugged where I typed in the 
> expression that failed.

> Program received signal SIGSEGV, Segmentation fault.
> 0x42d05bda in QWidgetPrivate::q_func (this=0x0) at qwidget_p.h:157
> The program being debugged was signaled while in a function called from GDB.
> GDB remains in the frame where the signal was received.
> To change this behavior use "set unwindonsignal on"
> Evaluation of the expression containing the function (QWidget::x() 
> const) will be abandoned.

As the message suggests, if unwindonsignal is set, you won't run into
this problem.  However, once you do, there's no easy way out yet.

This might work though: instead of "fin", try "signal 0" to resume,
and then the application should resume running.  Or try "handle SIGSEGV
nopass" and then finish should work.

I think.  I haven't tried it lately.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-01-10  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-10  0:51 How to pop -c in gdb William K. Foster
2007-01-10  2:51 ` Daniel Jacobowitz

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