This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 7.12] Throw SJ/LJ exception on error in disassembly
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Fri, 20 Jan 2017 00:24:15 +0000
- Subject: Re: [PATCH 7.12] Throw SJ/LJ exception on error in disassembly
- Authentication-results: sourceware.org; auth=none
- References: <1484758323-5467-1-git-send-email-yao.qi@linaro.org>
On 01/18/2017 04:52 PM, Yao Qi wrote:
> PR 20939 reports that GDB will abort on memory error in disassembly,
>
> (gdb) disassemble 0x0,+4
> Dump of assembler code from 0x0 to 0x4:
> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'
> 0x0000000000000000: Aborted
>
> (gdb) guile (print (arch-disassemble arch 0 #:size 4))^M
> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'^M
> ERROR: Process no longer exists
>
> This patch fixes PR 20939 in 7.12 branch by catching C++ exception,
> throwing SJ/LJ exception in the call back passed to C functions of opcodes,
> and catching SJ/LJ exception in gdb, and throw exception.
>
> The patch follows this commit
>
> 89525768cd086a0798a504c81fdf7ebcd4c904e1
> Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH
>
> rather than "backport" the fix to this PR I posted for mainline
> https://sourceware.org/ml/gdb-patches/2017-01/msg00288.html because the
> fix for mainline includes 1) some changes to opcodes, 2) some refactors
> in C++. All of them are risky to backport to 7.12 branch.
>
> With this patch applied to 7.12 branch, GDB doesn't abort on memory error
> in disassembly. It fixes some test failures in gdb.guile/scm-disasm.exp
> and gdb.python/py-arch.exp on aarch64-linux.
>
> -ERROR: Process no longer exists
> -UNRESOLVED: gdb.guile/scm-disasm.exp: test bad memory access
> +PASS: gdb.guile/scm-disasm.exp: test bad memory access
>
> -ERROR: Process no longer exists
> -UNRESOLVED: gdb.python/py-arch.exp: test bad memory access
> +PASS: gdb.python/py-arch.exp: test bad memory access
>
> I'll add the scm-disasm test to master later.
LGTM.
Thanks,
Pedro Alves