This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: How to skip function prologues with stabs debug infomation?
On Sat, 20 Aug 2011 15:06:44 +0200, Triple Yang wrote:
> I will give a C-like pseudocode to describe what I plan to do in
> function XXX_skip_prologue(), here XXX represents my architecture
> name.
>
> line = get_line_number(func_addr);
>
> next_line = find_next_statement_line_number(line); // take
> advantage of debug info
>
> addr = get_addr(nexe_line);
>
> Here, if func_addr is the start address of a function, we actually
> skip the function prologue. (But I am not sure this idea is proper.)
Yes, it is rought what GDB already does for all the arches.
gdbarch_skip_prologue is there for the case you have no debug info (neither
DWARF nor STABS, no -g). So it is good to implement gdbarch_skip_prologue but
it should be only based on instructions decoding in such case.
> And I guess gdb does the similar thing to step a source code line,
> which is of course arch-independent. But I don't know where those
> codes are placed. GDBing a gdb to locate them is time-consuming and
> tiring. I will be very grateful if you or someone else point it out.
I already stated here the GDB function is skip_prologue_sal.
Thanks,
Jan