Re: Fix GDB crash while trying to display the return type of a JIT frame.

Daniel Jacobowitz
2012-06-05T14:14:33Z

On Mon, Jun 4, 2012 at 4:45 PM, Kaushik Srenevasan <kaushik@twitter.com> wrote:
> This patch fixes GDB crashes due to missing function return type on
> JIT reader symbols.

The approach makes sense.

> 2012-06-04  Kaushik Srenevasan  <kaushik@twitter.com>
>
>        * jit.c (finalize_symtab): Set function's return type to 'void'
>          by default.

Nit: second line should line up with the asterisk, not further in.

>
> diff --git a/gdb/jit.c b/gdb/jit.c
> index f172e41..7bd4a27 100644
> --- a/gdb/jit.c
> +++ b/gdb/jit.c
> @@ -672,6 +672,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
>       SYMBOL_DOMAIN (block_name) = VAR_DOMAIN;
>       SYMBOL_CLASS (block_name) = LOC_BLOCK;
>       SYMBOL_SYMTAB (block_name) = symtab;
> +      SYMBOL_TYPE (block_name) = lookup_function_type(arch_type(target_gdbarch, TYPE_CODE_VOID, 1, "void"));

Nits: watch out for the coding style, particularly space before open
paren and 80 column limit.

>       SYMBOL_BLOCK_VALUE (block_name) = new_block;
>
>       block_name->ginfo.name = obsavestring (gdb_block_iter->name,

--
Thanks,
Daniel