Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* namespaces and gdb
@ 2000-06-28  7:34 Alexander Zhuckov
  2000-06-28 10:28 ` Daniel Berlin
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Zhuckov @ 2000-06-28  7:34 UTC (permalink / raw)
  To: gdb

Hi!

I use Linux, C++ and gdb 5.0.
Suppose I have a simple program:

namespace Foo {

    const char version[] = "0.1";

}

int main()
{
    return 0;
}

How I can eximine a value of the Foo::vesrion varibale?

-- 
Alexander Zhuckov   zuav@int.spb.ru   2:5030/518.50
From lucier@math.purdue.edu Wed Jun 28 10:02:00 2000
From: Brad Lucier <lucier@math.purdue.edu>
To: gdb@sourceware.cygnus.com
Cc: lucier@math.purdue.edu
Subject: difficulties debugging code
Date: Wed, 28 Jun 2000 10:02:00 -0000
Message-id: <200006281702.MAA07082@polya.math.purdue.edu>
X-SW-Source: 2000-06/msg00197.html
Content-length: 2973

I sent the following message to the gcc-help and gcc-bugs mailing
lists, but perhaps it may be more appropriate for this list.
I could sure use some help.

Brad Lucier

----- Begin Included Message -----

From lucier@math.purdue.edu  Tue Jun 27 14:13:37 2000
Date: Tue, 27 Jun 2000 14:13:35 -0500 (EST)
From: Brad Lucier <lucier@math.purdue.edu>
To: gcc-help@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: difficulties debugging code
Cc: lucier@math.purdue.edu

I don't know if this is a bug or whether I need help, so I'm asking both
lists.

I'm trying to debug some code compiled with gcc-2.96-20000624 on
alphaev6-unknown-linux-gnu with options

gcc -fno-math-errno -mieee -mcpu=ev6  -Wall -W -O1 -save-temps -g -c ...

and linked with

gcc -g -mieee -rdynamic ...

I'm using gdb 4.17.0.11.  Everything is fine until I try to step through the
following code:

void ___setup
   (___setup_params_struct *setup_params)
{
  ___processor_state ___ps;
  ___mod_or_lnk mol;
  int i;
  if (setup_params == 0 ||
      setup_params->version_major != 21)
    return;
  if (setup_state != 0)
    return;
  setup_state = 2;  
 ___setup_params = *setup_params; // <<<<<<<<<<<<<<<<<<<<<<<<<
...

Then I get a segmentation fault with the following message:

(gdb) s

Program received signal SIGSEGV, Segmentation fault.
warning: Hit beginning of text section without finding
warning: enclosing function for address 0xc39fff54
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable).  In that case, you may wish to
increase the size of the search with the `set heuristic-fence-post' command.

Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.
0xc39fff54 in ?? ()
(gdb)  up
#1  0x120043b00 in ___setup (setup_params=0x11ffff720) at setup.c:1415
1415      ___setup_params = *setup_params;
(gdb) print *setup_params
$1 = {version_major = 21, version_minor = 0, argc = 1, argv = 0x11ffff868, min_heap = 0, max_heap = 0, live_percent = 0, gc_hook = 0, fatal_error = 0, 
  standard = 0, debug_level = 0, default_io_encoding = 1, force_tty = 0, force_unbuffered_io = 0, linker = 0x120041410 <____20_gsi__>, event_get = 0, 
  event_handler = 0, dummy1 = 0, dummy2 = 0, dummy3 = 0, dummy4 = 0, dummy5 = 0, dummy6 = 0, dummy7 = 0, dummy8 = 0}

So *setup_params seems perfectly fine.

The assembly code at this point is

$LM658:
	.stabn 68,0,1415,$LM658
	lda $16,___setup_params
	lda $18,176
	jsr $26,memcpy
	ldgp $29,0($26)

The real bug I'm trying to track down is a little farther along in
the execution path, so I'm just getting frustrated playing with this
part of the code.

So, do any of you have any ideas?  If I set a breakpoint after this
point in the code and start stepping from there, it just segfaults
in some other place (where there really isn't a problem, either).
I haven't seen this type of behavior before.

Brad Lucier


----- End Included Message -----


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

end of thread, other threads:[~2000-06-28 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-28  7:34 namespaces and gdb Alexander Zhuckov
2000-06-28 10:28 ` Daniel Berlin

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