[Pdbg] [PATCH v3 12/13] libpdbg/chip.c: ram_instructions add error handling
Alistair Popple
alistair at popple.id.au
Tue May 8 11:39:00 AEST 2018
Yeah, (lib)pdbg error handling is pretty broken generally as I just left it as a
giant "TODO". Open to any thoughts on how we could improve it generally.
- Alistair
On Wednesday, 2 May 2018 4:28:07 PM AEST Nicholas Piggin wrote:
> Pass errors back to the caller, and clean up with ram_destroy on
> failure.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> libpdbg/chip.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libpdbg/chip.c b/libpdbg/chip.c
> index 79bc87d..ebfaaa8 100644
> --- a/libpdbg/chip.c
> +++ b/libpdbg/chip.c
> @@ -168,7 +168,11 @@ static int ram_instructions(struct pdbg_target *thread_target, uint64_t *opcodes
> opcode = mfspr(1, 277);
> }
>
> - CHECK_ERR(thread->ram_instruction(thread, opcode, &scratch));
> + if (thread->ram_instruction(thread, opcode, &scratch)) {
> + PR_DEBUG("%s: %d\n", __FUNCTION__, __LINE__);
> + exception = 1;
> + break;
> + }
>
> if (i == -2)
> r1 = scratch;
>
More information about the Pdbg
mailing list