This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: Avoid calling XXX_skip_prologue for assembly code
- To: fnf at ninemoons dot com
- Subject: Re: RFC: Avoid calling XXX_skip_prologue for assembly code
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: 11 Oct 2001 15:14:47 -0500
- Cc: gdb-patches at sources dot redhat dot com
- References: <200110051954.f95JsNn07270@fishpond.ninemoons.com>
Fred Fish <fnf@www.ninemoons.com> writes:
> Does anyone have any issues with the attached patch?
>
> There is little point in attempting to skip over prologues if we
> already know for a fact that the source language is assembly.
>
> In fact, attempting to do so may actually be incorrect if the user has
> taken the output of the compiler, used that as the basis for his code,
> and hand optimized it in some way to produce an assembly version.
> There could still be prologue code in the hand crafted version.
>
> Another way to handle this issue would be to have each of the
> "XXX_skip_prologue" functions in the various XXX-tdep.c files do their
> own checking first to see if the language is assembly, but they don't
> have easy access to that info, and each of them would have to do
> something similar to this patch anyway, so it seems more logical to
> just do the test in one place.
This seems like a good idea, but I'm told that Red Hat has an
(as-of-yet unreleased) port which actually analyzes prologues for
assembly-language functions. I assume there's some sort of underlying
ABI that justifies this.
>
> -Fred
>
> ==================================================================
>
> 2001-10-05 Fred Fish <fnf@cygnus.com>
>
> * symtab.c (find_function_start_sal): Do not attempt to skip over
> prologues for assembly functions.
>
> Index: symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.42
> diff -u -p -r1.42 symtab.c
> --- symtab.c 2001/07/07 17:19:50 1.42
> +++ symtab.c 2001/10/05 19:42:05
> @@ -2031,7 +2031,7 @@ find_function_start_sal (struct symbol *
>
> pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
> fixup_symbol_section (sym, NULL);
> - if (funfirstline)
> + if (funfirstline && SYMBOL_LANGUAGE(sym) != language_asm)
> { /* skip "first line" of function (which is actually its prologue) */
> asection *section = SYMBOL_BFD_SECTION (sym);
> /* If function is in an unmapped overlay, use its unmapped LMA
>