This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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

difficulties debugging code


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

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