From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Zhuckov To: gdb@sourceware.cygnus.com Subject: namespaces and gdb Date: Wed, 28 Jun 2000 07:34:00 -0000 Message-id: <877lb96foa.fsf@ithilien.int.spb.ru> X-SW-Source: 2000-06/msg00196.html 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 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 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 -----