Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix GDB crash while trying to display the return type of a JIT frame.
@ 2012-06-04 20:47 Kaushik Srenevasan
  2012-06-05 14:14 ` Daniel Jacobowitz
  2012-06-05 15:38 ` Pedro Alves
  0 siblings, 2 replies; 6+ messages in thread
From: Kaushik Srenevasan @ 2012-06-04 20:47 UTC (permalink / raw)
  To: gdb-patches

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,


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix GDB crash while trying to display the return type of a JIT frame.
  2012-06-04 20:47 Fix GDB crash while trying to display the return type of a JIT frame Kaushik Srenevasan
@ 2012-06-05 14:14 ` Daniel Jacobowitz
  2012-06-05 21:16   ` Kaushik Srenevasan
  2012-06-05 15:38 ` Pedro Alves
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2012-06-05 14:14 UTC (permalink / raw)
  To: Kaushik Srenevasan; +Cc: gdb-patches

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix GDB crash while trying to display the return type of a JIT frame.
  2012-06-04 20:47 Fix GDB crash while trying to display the return type of a JIT frame Kaushik Srenevasan
  2012-06-05 14:14 ` Daniel Jacobowitz
@ 2012-06-05 15:38 ` Pedro Alves
  1 sibling, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2012-06-05 15:38 UTC (permalink / raw)
  To: Kaushik Srenevasan; +Cc: gdb-patches

On 06/04/2012 09:45 PM, Kaushik Srenevasan wrote:

> @@ -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"));


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.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix GDB crash while trying to display the return type of a JIT frame.
  2012-06-05 14:14 ` Daniel Jacobowitz
@ 2012-06-05 21:16   ` Kaushik Srenevasan
  2012-06-13 21:16     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Kaushik Srenevasan @ 2012-06-05 21:16 UTC (permalink / raw)
  To: daniel.jacobowitz, palves; +Cc: gdb-patches

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,


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix GDB crash while trying to display the return type of a JIT frame.
  2012-06-05 21:16   ` Kaushik Srenevasan
@ 2012-06-13 21:16     ` Tom Tromey
  2012-06-13 21:52       ` Kaushik Srenevasan
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2012-06-13 21:16 UTC (permalink / raw)
  To: Kaushik Srenevasan; +Cc: daniel.jacobowitz, palves, gdb-patches

>>>>> "Kaushik" == Kaushik Srenevasan <kaushik@twitter.com> writes:

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

Thanks, I'm checking this in now.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix GDB crash while trying to display the return type of a JIT frame.
  2012-06-13 21:16     ` Tom Tromey
@ 2012-06-13 21:52       ` Kaushik Srenevasan
  0 siblings, 0 replies; 6+ messages in thread
From: Kaushik Srenevasan @ 2012-06-13 21:52 UTC (permalink / raw)
  To: Tom Tromey; +Cc: daniel.jacobowitz, palves, gdb-patches

On Wed, Jun 13, 2012 at 2:16 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Kaushik" == Kaushik Srenevasan <kaushik@twitter.com> writes:
>
> Kaushik> 2012-06-04  Kaushik Srenevasan  <kaushik@twitter.com>
> Kaushik>        * jit.c (finalize_symtab): Set function's return type to 'void'
> Kaushik>        by default.
>
> Thanks, I'm checking this in now.
>

Thank you!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-06-13 21:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04 20:47 Fix GDB crash while trying to display the return type of a JIT frame Kaushik Srenevasan
2012-06-05 14:14 ` Daniel Jacobowitz
2012-06-05 21:16   ` Kaushik Srenevasan
2012-06-13 21:16     ` Tom Tromey
2012-06-13 21:52       ` Kaushik Srenevasan
2012-06-05 15:38 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox