This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] Fix segfault when unwinding JIT frames using a custom reader.
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Sanjoy Das <sanjoy at playingwithpointers dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 1 Dec 2012 21:25:22 +0100
- Subject: Re: [PATCH 1/3] Fix segfault when unwinding JIT frames using a custom reader.
- References: <1352048631-25042-1-git-send-email-sanjoy@playingwithpointers.com> <1352048631-25042-2-git-send-email-sanjoy@playingwithpointers.com>
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