This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb questionable stack trace


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]