* Does gdb support weak/normal symbols?
@ 2006-01-16 0:48 H. J. Lu
2006-01-16 1:49 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-01-16 0:48 UTC (permalink / raw)
To: GDB
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
I got
[hjl@gnu-10 weak]$ make
cc -o foo -O -g main.c foo.c weak.c
for f in foo; do ./$f; done
Normal foo
[hjl@gnu-10 weak]$ gdb foo
GNU gdb 6.4.50.20060115-cvs
...
(gdb) b foo
Breakpoint 1 at 0x804839a: file weak.c, line 8.
(gdb) r
Starting program: /export/home/hjl/bugs/gdb/weak/foo
Normal foo
Program exited normally.
(gdb) b *0x08048380
Breakpoint 2 at 0x8048380: file foo.c, line 5.
(gdb) r
Starting program: /export/home/hjl/bugs/gdb/weak/foo
Breakpoint 1 at 0x8048386: file foo.c, line 6.
Breakpoint 2, foo () at foo.c:5
5 {
(gdb)
foo in weak.c isn't in the symbol table. But gdb sets the breakpoint
of foo on it. Shouldn't gdb be clever enough to know to check the
other one?
H.J.
[-- Attachment #2: bug.tar.gz --]
[-- Type: application/x-gzip, Size: 466 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Does gdb support weak/normal symbols?
2006-01-16 0:48 Does gdb support weak/normal symbols? H. J. Lu
@ 2006-01-16 1:49 ` Daniel Jacobowitz
2006-01-16 15:48 ` H. J. Lu
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 1:49 UTC (permalink / raw)
To: H. J. Lu; +Cc: GDB
On Sun, Jan 15, 2006 at 04:48:31PM -0800, H. J. Lu wrote:
> foo in weak.c isn't in the symbol table. But gdb sets the breakpoint
> of foo on it. Shouldn't gdb be clever enough to know to check the
> other one?
GDB uses the debug information in preference to the ELF symbol table.
That one says this is a definition of foo.
Eventually "break foo" will breakpoint both of them.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 1:49 ` Daniel Jacobowitz
@ 2006-01-16 15:48 ` H. J. Lu
2006-01-16 15:58 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-01-16 15:48 UTC (permalink / raw)
To: GDB
On Sun, Jan 15, 2006 at 08:49:04PM -0500, Daniel Jacobowitz wrote:
> On Sun, Jan 15, 2006 at 04:48:31PM -0800, H. J. Lu wrote:
> > foo in weak.c isn't in the symbol table. But gdb sets the breakpoint
> > of foo on it. Shouldn't gdb be clever enough to know to check the
> > other one?
>
> GDB uses the debug information in preference to the ELF symbol table.
> That one says this is a definition of foo.
>
> Eventually "break foo" will breakpoint both of them.
What did you mean by "Eventually"? Were you saying that it was a bug
and would be fixed in the future? Is anyone working on it? I'd like
to help.
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 15:48 ` H. J. Lu
@ 2006-01-16 15:58 ` Daniel Jacobowitz
2006-01-16 18:11 ` H. J. Lu
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 15:58 UTC (permalink / raw)
To: H. J. Lu; +Cc: GDB
On Mon, Jan 16, 2006 at 07:47:54AM -0800, H. J. Lu wrote:
> On Sun, Jan 15, 2006 at 08:49:04PM -0500, Daniel Jacobowitz wrote:
> > On Sun, Jan 15, 2006 at 04:48:31PM -0800, H. J. Lu wrote:
> > > foo in weak.c isn't in the symbol table. But gdb sets the breakpoint
> > > of foo on it. Shouldn't gdb be clever enough to know to check the
> > > other one?
> >
> > GDB uses the debug information in preference to the ELF symbol table.
> > That one says this is a definition of foo.
> >
> > Eventually "break foo" will breakpoint both of them.
>
> What did you mean by "Eventually"? Were you saying that it was a bug
> and would be fixed in the future? Is anyone working on it? I'd like
> to help.
Please read the archives for the last few days. This is covered by the
same general problem description as "break FILE:LINE" - you have asked
for an ambiguous breakpoint, and instead of properly placing multiple
breakpoints or prompting GDB has picked one at random.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 15:58 ` Daniel Jacobowitz
@ 2006-01-16 18:11 ` H. J. Lu
2006-01-16 18:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-01-16 18:11 UTC (permalink / raw)
To: GDB
On Mon, Jan 16, 2006 at 10:58:46AM -0500, Daniel Jacobowitz wrote:
> On Mon, Jan 16, 2006 at 07:47:54AM -0800, H. J. Lu wrote:
> > On Sun, Jan 15, 2006 at 08:49:04PM -0500, Daniel Jacobowitz wrote:
> > > On Sun, Jan 15, 2006 at 04:48:31PM -0800, H. J. Lu wrote:
> > > > foo in weak.c isn't in the symbol table. But gdb sets the breakpoint
> > > > of foo on it. Shouldn't gdb be clever enough to know to check the
> > > > other one?
> > >
> > > GDB uses the debug information in preference to the ELF symbol table.
> > > That one says this is a definition of foo.
> > >
> > > Eventually "break foo" will breakpoint both of them.
> >
> > What did you mean by "Eventually"? Were you saying that it was a bug
> > and would be fixed in the future? Is anyone working on it? I'd like
> > to help.
>
> Please read the archives for the last few days. This is covered by the
> same general problem description as "break FILE:LINE" - you have asked
> for an ambiguous breakpoint, and instead of properly placing multiple
> breakpoints or prompting GDB has picked one at random.
>
"break foo" may be slightly different from "break FILE:LINE". For the
global symbol, foo, there will be only one definition. It is a
matter of picking the right foo for "break foo". There is no need to
set multiple breakpoints nor prompt user.
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 18:11 ` H. J. Lu
@ 2006-01-16 18:30 ` Daniel Jacobowitz
2006-01-16 18:32 ` H. J. Lu
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 18:30 UTC (permalink / raw)
To: H. J. Lu; +Cc: GDB
On Mon, Jan 16, 2006 at 10:11:31AM -0800, H. J. Lu wrote:
> "break foo" may be slightly different from "break FILE:LINE". For the
> global symbol, foo, there will be only one definition. It is a
> matter of picking the right foo for "break foo". There is no need to
> set multiple breakpoints nor prompt user.
This is wrong. You're still thinking about a compiler and a linker,
not about a debugger. There may also be a dozen static functions named
"foo", and one of them may happen to be in the current file and the
user may just have been looking at it.
Since we can't read the user's mind, we have to do our best to silently
accomodate the user's potential intentions.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 18:30 ` Daniel Jacobowitz
@ 2006-01-16 18:32 ` H. J. Lu
2006-01-16 18:53 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: H. J. Lu @ 2006-01-16 18:32 UTC (permalink / raw)
To: GDB
On Mon, Jan 16, 2006 at 01:30:52PM -0500, Daniel Jacobowitz wrote:
> On Mon, Jan 16, 2006 at 10:11:31AM -0800, H. J. Lu wrote:
> > "break foo" may be slightly different from "break FILE:LINE". For the
> > global symbol, foo, there will be only one definition. It is a
> > matter of picking the right foo for "break foo". There is no need to
> > set multiple breakpoints nor prompt user.
>
> This is wrong. You're still thinking about a compiler and a linker,
> not about a debugger. There may also be a dozen static functions named
> "foo", and one of them may happen to be in the current file and the
How can a static function be global?
H.J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 18:32 ` H. J. Lu
@ 2006-01-16 18:53 ` Daniel Jacobowitz
2006-01-16 18:35 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 18:53 UTC (permalink / raw)
To: gdb, GDB
On Mon, Jan 16, 2006 at 10:32:13AM -0800, H. J. Lu wrote:
> On Mon, Jan 16, 2006 at 01:30:52PM -0500, Daniel Jacobowitz wrote:
> > On Mon, Jan 16, 2006 at 10:11:31AM -0800, H. J. Lu wrote:
> > > "break foo" may be slightly different from "break FILE:LINE". For the
> > > global symbol, foo, there will be only one definition. It is a
> > > matter of picking the right foo for "break foo". There is no need to
> > > set multiple breakpoints nor prompt user.
> >
> > This is wrong. You're still thinking about a compiler and a linker,
> > not about a debugger. There may also be a dozen static functions named
> > "foo", and one of them may happen to be in the current file and the
>
> How can a static function be global?
This is not C++. There's no One Definition Rule. The existence of a
global function "foo" somewhere in the executable does not preclude the
existence of a static function "foo" somewhere else, in the same
binary, in a dynamically loaded library, et cetera.
In fact it's passably likely.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Does gdb support weak/normal symbols?
2006-01-16 18:53 ` Daniel Jacobowitz
@ 2006-01-16 18:35 ` Daniel Jacobowitz
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 18:35 UTC (permalink / raw)
To: gdb, GDB
On Mon, Jan 16, 2006 at 10:32:13AM -0800, H. J. Lu wrote:
> On Mon, Jan 16, 2006 at 01:30:52PM -0500, Daniel Jacobowitz wrote:
> > On Mon, Jan 16, 2006 at 10:11:31AM -0800, H. J. Lu wrote:
> > > "break foo" may be slightly different from "break FILE:LINE". For the
> > > global symbol, foo, there will be only one definition. It is a
> > > matter of picking the right foo for "break foo". There is no need to
> > > set multiple breakpoints nor prompt user.
> >
> > This is wrong. You're still thinking about a compiler and a linker,
> > not about a debugger. There may also be a dozen static functions named
> > "foo", and one of them may happen to be in the current file and the
>
> How can a static function be global?
This is not C++. There's no One Definition Rule. The existence of a
global function "foo" somewhere in the executable does not preclude the
existence of a static function "foo" somewhere else, in the same
binary, in a dynamically loaded library, et cetera.
In fact it's passably likely.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-01-16 18:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-16 0:48 Does gdb support weak/normal symbols? H. J. Lu
2006-01-16 1:49 ` Daniel Jacobowitz
2006-01-16 15:48 ` H. J. Lu
2006-01-16 15:58 ` Daniel Jacobowitz
2006-01-16 18:11 ` H. J. Lu
2006-01-16 18:30 ` Daniel Jacobowitz
2006-01-16 18:32 ` H. J. Lu
2006-01-16 18:53 ` Daniel Jacobowitz
2006-01-16 18:35 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox