public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb questionable stack trace
@ 2005-04-25 20:44 Ross Boylan
  0 siblings, 0 replies; only message in thread
From: Ross Boylan @ 2005-04-25 20:44 UTC (permalink / raw)
  To: gdb; +Cc: ross

I am trying to debug a SIGSEGV in a C++ program.  Whether I look at it
after the fault or try to trace into it before the fault the stack
trace, in particular the association of functions with files, seems to
get disoriented.

I have a Data class, which contains no explicit destructor.
The problem starts with code that does "delete pData" where pData is
type Data *.

The next step takes me to the function ~Data()
~Data (this=0x809de18)
at /home/ross/peter/R/mspath/src/test/Data_test.cc:69

Data_test.cc does not define data, only tests it.  The indicated line is
  delete pd1;
another pointer to data deletion.

If this code is really getting executed, something is very wrong,
because the relevant function is nowhere in the call stack (having been
executed earlier).  It also might explain my problems, since it would be
a double deletion.

Has gdb just become disoriented by the lack of a source file definition
of ~Data(), or is something else going on?

The confusion continues in the next step, which again names an
appropriate function but a bad source line:
~Array2D (this=0x809de3c) at mspath.web:4952
The source code line indicated is in the c'tor for Data.  Again, I have
no explicit ~Array2D.

mspath.web is the original source of my code, which ended up in source
files using #line directives.  Perhaps the #line is confusing things?

The next step, in ~valarray() finally has things back to normal.

Debian GNU/Linux, 2.4.27 kernel, Athlon chip.
GNU gdb 6.3-debian
g++ (GCC) 3.3.5 (Debian 1:3.3.5-8)

Compiled with -O0.

-- 
Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          ross@biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-25 20:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-25 20:44 gdb questionable stack trace Ross Boylan

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).