[PATCH 1/3] Fix segfault when unwinding JIT frames using a custom reader.
Jan Kratochvil
jan.kratochvil@redhat.com
Sat Dec 1 20:25:00 GMT 2012
On Sun, 04 Nov 2012 18:03:49 +0100, Sanjoy Das wrote:
> Issue http://sourceware.org/bugzilla/show_bug.cgi?id=14550
[...]
> --- a/gdb/jit.c
> +++ b/gdb/jit.c
> @@ -724,8 +724,18 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
> gdb_block_iter = gdb_block_iter->next)
> {
> if (gdb_block_iter->parent != NULL)
> - BLOCK_SUPERBLOCK (gdb_block_iter->real_block) =
> - gdb_block_iter->parent->real_block;
> + {
> + /* If the plugin specifically mentioned a parent block, we
> + use that. */
> + BLOCK_SUPERBLOCK (gdb_block_iter->real_block) =
> + gdb_block_iter->parent->real_block;
> + }
> + else
> + {
> + /* And if not, we set a default parent block. */
> + BLOCK_SUPERBLOCK (gdb_block_iter->real_block) =
> + BLOCKVECTOR_BLOCK (symtab->blockvector, STATIC_BLOCK);
> + }
While I find this patch correct:
(1) The interface for JIT readers was AFAIK designed to be easier than what
GDB provides internally. Therefore I think gdb_block->parent should not
exist, it can be rebuilt from gdb_block->begin and gdb_block->end,
together with some assumption about gdb_block->next ordering.
(2) Otherwise to keep it ABI compatible one should at least sanity check and
error if gdb_block->begin and gdb_block->end do not match the ordering via
gdb_block->parent.
Thanks,
Jan
More information about the Gdb-patches
mailing list