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

Kaushik Srenevasan
2012-06-05T21:16:23Z

Daniel Jacobowitz <daniel.jacobowitz@gmail.com> writes:
> Nit: second line should line up with the asterisk, not further in.
>
> Nits: watch out for the coding style, particularly space before open
> paren and 80 column limit.

Fixed.

Pedro Alves <palves@redhat.com> writes:
> Pedantically, it'd be better to write 'get_objfile_arch (objfile)' instead
> of target_gdbarch, even though the objfile's gdbarch is initialized
> to target_gdbarch presently.

Fixed.

-Kaushik

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

diff --git a/gdb/jit.c b/gdb/jit.c
index f172e41..568d17b 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -660,6 +660,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
struct block *new_block = allocate_block (&objfile->objfile_obstack);
struct symbol *block_name = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
+ struct type *block_type = arch_type (get_objfile_arch (objfile),
+ TYPE_CODE_VOID,
+ 1,
+ "void");

BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack,
NULL);
@@ -672,6 +676,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 (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;

block_name->ginfo.name = obsavestring (gdb_block_iter->name,