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

Kaushik Srenevasan
2012-06-04T20:47:12Z

This patch fixes GDB crashes due to missing function return type on
JIT reader symbols.

See http://sourceware.org/ml/gdb/2012-05/msg00126.html for the
original discussion.

-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..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"));
SYMBOL_BLOCK_VALUE (block_name) = new_block;

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