This is the mail archive of the gdb@sourceware.cygnus.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]

gdb-4.95.1 problem with weak functions


Hi!

It seems that gdb-4.95.1  does not display correctly the function when
stoping in weak functions. 


It stops in a function that is defined as weak, not in the function
that is actualy run... 


here is an example:

--FILE t.c
int test_weak (void) __attribute__ ((weak));
   
int 
test_weak (void) 
{
  return 1;
}  
   
int
test (void)
{  
  return test_weak ();
}  
--END

--FILE main.c
int test (void);
   
int
test_weak (void)
{  
  return 2;
}  
   
int
main (void)
{  
  int val;
  val =  test ();
  printf ("val = %d\n", val);
  return val;
}  
--END

compile them with gcc-2.95.2 on sparc-sun-solaris2.7



~/test/gdb-4.95.1/bin/gdb a.out
GNU gdb 4.95.1
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.7"...
(gdb) b test_weak
Breakpoint 1 at 0x1094c: file t.c, line 6.
(gdb) r
Starting program: /home/dann/hacks/weak/a.out 


Breakpoint 1, test_weak () at t.c:6
6         return 1;
(gdb) 
(gdb) c
Continuing.
val = 2

Program exited with code 02.


the breakpoint should have been set in main.c, not in t.c
the debugger realy stoped the program, but did not display the correct
file name and line number of the function being executed (should have
been main.c) 

--dan

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