Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* breakpoint on non-function symbol
@ 2007-02-01 10:48 Bahadir Balban
  2007-02-01 11:01 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Bahadir Balban @ 2007-02-01 10:48 UTC (permalink / raw)
  To: gdb

Hi,

Is it possible to put a breakpoint on a symbol that is not a function?

I have two elf images, the first is a loader that contains the second
image in itself. I want to refer to a symbol defined in the second
from the first. To achieve that, I extracted the symbol from second
and defined it as a variable in the linker script of the first. When I
break on  the symbol gdb complains its not a function. I could
possibly define it as a function in assembler but I've done enough
tweaks; don't want to add more unless you have a better suggestion.

Thanks,
Bahadir


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

* Re: breakpoint on non-function symbol
  2007-02-01 10:48 breakpoint on non-function symbol Bahadir Balban
@ 2007-02-01 11:01 ` Andreas Schwab
  2007-02-01 11:26   ` Bahadir Balban
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2007-02-01 11:01 UTC (permalink / raw)
  To: Bahadir Balban; +Cc: gdb

"Bahadir Balban" <bahadir.balban@gmail.com> writes:

> Is it possible to put a breakpoint on a symbol that is not a function?

You can put a breakpoint at any address with the "break *ADDR" syntax.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: breakpoint on non-function symbol
  2007-02-01 11:01 ` Andreas Schwab
@ 2007-02-01 11:26   ` Bahadir Balban
  2007-02-01 12:20     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Bahadir Balban @ 2007-02-01 11:26 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb

On 2/1/07, Andreas Schwab <schwab@suse.de> wrote:
> "Bahadir Balban" <bahadir.balban@gmail.com> writes:
>
> > Is it possible to put a breakpoint on a symbol that is not a function?
>
> You can put a breakpoint at any address with the "break *ADDR" syntax.
>
> Andreas.


The problem is the address is not known in advance, so I had to rely
on the symbol. Anyway, I fixed it in assembler by:

.global symname;
.type symname, function;
.equ symname, addr

rather than including it in the linker script.

Thanks,
Bahadir


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

* Re: breakpoint on non-function symbol
  2007-02-01 11:26   ` Bahadir Balban
@ 2007-02-01 12:20     ` Daniel Jacobowitz
  2007-02-01 23:21       ` Bahadir Balban
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-02-01 12:20 UTC (permalink / raw)
  To: Bahadir Balban; +Cc: Andreas Schwab, gdb

On Thu, Feb 01, 2007 at 11:26:34AM +0000, Bahadir Balban wrote:
> The problem is the address is not known in advance, so I had to rely
> on the symbol. Anyway, I fixed it in assembler by:
> 
> .global symname;
> .type symname, function;
> .equ symname, addr
> 
> rather than including it in the linker script.

That works, or you can take advantage of what Andreas suggested:

set $var = &symbol
break *$var

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: breakpoint on non-function symbol
  2007-02-01 12:20     ` Daniel Jacobowitz
@ 2007-02-01 23:21       ` Bahadir Balban
  0 siblings, 0 replies; 5+ messages in thread
From: Bahadir Balban @ 2007-02-01 23:21 UTC (permalink / raw)
  To: Bahadir Balban, Andreas Schwab, gdb

On 2/1/07, Daniel Jacobowitz <drow@false.org> wrote:
> That works, or you can take advantage of what Andreas suggested:
>
> set $var = &symbol
> break *$var
>
> --
> Daniel Jacobowitz
> CodeSourcery
>

Ah, ok. That's the trick I was hoping to learn.

Thanks,
Bahadir


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

end of thread, other threads:[~2007-02-01 23:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-01 10:48 breakpoint on non-function symbol Bahadir Balban
2007-02-01 11:01 ` Andreas Schwab
2007-02-01 11:26   ` Bahadir Balban
2007-02-01 12:20     ` Daniel Jacobowitz
2007-02-01 23:21       ` Bahadir Balban

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox