* adding comments/labels?
@ 2007-08-29 21:06 jf
2007-08-29 21:13 ` Daniel Jacobowitz
2007-08-30 14:28 ` Baurzhan Ismagulov
0 siblings, 2 replies; 6+ messages in thread
From: jf @ 2007-08-29 21:06 UTC (permalink / raw)
To: gdb
After digging through the documentation some and realizing how futile
google is when you search for things like 'gdb comments' or 'gdb
labels'/et cetera, I turn to you all ;]
Is there any way to add a label/comment/rename a symbol in gdb?
specifically what I'd like to do is add symbol resolution to addresses,
i.e.
call 0x12345678
I disassemble the code at 0x12345678 and see that it just does:
mov $0x04, %al
sysenter
cmp [...]
and I can say, oh thats a sys_write wrapper, so I'd like to relabel it as
'sys_write', so now when I run across a call to it i see:
call <sys_write_wrapper>
I'm assuming no such functionality exists, as I can find nothing about it,
so that said, can anyone direct me to where I should touch gdb to add such
functionality?
thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: adding comments/labels?
2007-08-29 21:06 adding comments/labels? jf
@ 2007-08-29 21:13 ` Daniel Jacobowitz
2007-08-29 21:18 ` jf
2007-08-30 14:28 ` Baurzhan Ismagulov
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-08-29 21:13 UTC (permalink / raw)
To: jf; +Cc: gdb
On Thu, Aug 30, 2007 at 04:38:47AM +0000, jf wrote:
> After digging through the documentation some and realizing how futile
> google is when you search for things like 'gdb comments' or 'gdb
> labels'/et cetera, I turn to you all ;]
>
> Is there any way to add a label/comment/rename a symbol in gdb?
No.
> I'm assuming no such functionality exists, as I can find nothing about it,
> so that said, can anyone direct me to where I should touch gdb to add such
> functionality?
Not really. I think you should do it with objcopy, instead. Haven't
I suggested this to someone else recently on this list... ?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: adding comments/labels?
2007-08-29 21:13 ` Daniel Jacobowitz
@ 2007-08-29 21:18 ` jf
2007-08-29 21:25 ` Daniel Jacobowitz
2007-08-29 21:30 ` Joel Brobecker
0 siblings, 2 replies; 6+ messages in thread
From: jf @ 2007-08-29 21:18 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb
>
> Not really. I think you should do it with objcopy, instead. Haven't
> I suggested this to someone else recently on this list... ?
Why would I want to do it with objcopy? I'm reversing a binary and I'd
like a label so I don't single step into the same function every time, its
that or try to remember the address of every function I've looked at.
I'll just have to do it the hardway and cludge through the source and
figure out where symbol resolution occurs. Thanks for the typical OSS/FS
help ('no do it my way instead')
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: adding comments/labels?
2007-08-29 21:18 ` jf
@ 2007-08-29 21:25 ` Daniel Jacobowitz
2007-08-29 21:30 ` Joel Brobecker
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-08-29 21:25 UTC (permalink / raw)
To: jf; +Cc: gdb
On Thu, Aug 30, 2007 at 04:50:40AM +0000, jf wrote:
> >
> > Not really. I think you should do it with objcopy, instead. Haven't
> > I suggested this to someone else recently on this list... ?
>
> Why would I want to do it with objcopy? I'm reversing a binary and I'd
> like a label so I don't single step into the same function every time, its
> that or try to remember the address of every function I've looked at.
>
> I'll just have to do it the hardway and cludge through the source and
> figure out where symbol resolution occurs. Thanks for the typical OSS/FS
> help ('no do it my way instead')
If you're going to be insulting when offered advice, please don't
expect to get help again.
I recommended using objcopy because objcopy supports modifying symbol
tables and GDB does not. You can write a GDB macro to use objcopy to
add the symbol, replace the original binary, and reload it into GDB.
It'll be about five lines. This will be about a million times easier
than trying to add a new GDB command to modify the symbol table.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: adding comments/labels?
2007-08-29 21:18 ` jf
2007-08-29 21:25 ` Daniel Jacobowitz
@ 2007-08-29 21:30 ` Joel Brobecker
1 sibling, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2007-08-29 21:30 UTC (permalink / raw)
To: jf; +Cc: Daniel Jacobowitz, gdb
> I'll just have to do it the hardway and cludge through the source and
> figure out where symbol resolution occurs. Thanks for the typical OSS/FS
> help ('no do it my way instead')
I think you are being unfair to Daniel. He's one of the very few that
are constantly helping people using & modifying GDB. He just gave
you the solution which he believes is going to help you most. It's
too bad it's not the answer you were hoping for.
As far as your specific question goes: Name resolution is performed
in symtab.c (all the "lookup_..." routines). You'll probably benefit
from reading the "internals" documentation section on symbols.
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: adding comments/labels?
2007-08-29 21:06 adding comments/labels? jf
2007-08-29 21:13 ` Daniel Jacobowitz
@ 2007-08-30 14:28 ` Baurzhan Ismagulov
1 sibling, 0 replies; 6+ messages in thread
From: Baurzhan Ismagulov @ 2007-08-30 14:28 UTC (permalink / raw)
To: gdb
On Thu, Aug 30, 2007 at 04:38:47AM +0000, jf wrote:
> Is there any way to add a label/comment/rename a symbol in gdb?
Perhaps you'd want to look at IDA Pro?
With kind regards,
--
Baurzhan Ismagulov
http://www.kz-easy.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-08-30 14:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-29 21:06 adding comments/labels? jf
2007-08-29 21:13 ` Daniel Jacobowitz
2007-08-29 21:18 ` jf
2007-08-29 21:25 ` Daniel Jacobowitz
2007-08-29 21:30 ` Joel Brobecker
2007-08-30 14:28 ` Baurzhan Ismagulov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox