public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb-4.95.1 problem with weak functions
@ 2000-05-12  2:25 Dan Nicolaescu
  2000-05-12  3:43 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2000-05-12  2:25 UTC (permalink / raw)
  To: gdb

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

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

* Re: gdb-4.95.1 problem with weak functions
  2000-05-12  2:25 gdb-4.95.1 problem with weak functions Dan Nicolaescu
@ 2000-05-12  3:43 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2000-05-12  3:43 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: gdb

Dan Nicolaescu wrote:
> 
> 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...

Thanks.

I've added a note to the list of known problems for 5.0.  I suspect that
the symtab maintainer may be planning on fixing it in 5.1 rather than
5.0 (but it is up to them).

	Andrew

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

end of thread, other threads:[~2000-05-12  3:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-12  2:25 gdb-4.95.1 problem with weak functions Dan Nicolaescu
2000-05-12  3:43 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).