From 23224687205076604c1e0e5829690a5b6e150c06 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 20 Jul 2022 09:33:21 +0200 Subject: program: fix reporting source position of first instruction We must always report the chunk source position relative to the function start offset, even if it is zero. Signed-off-by: Jo-Philipp Wich --- program.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/program.c b/program.c index bfe50bc..57252f8 100644 --- a/program.c +++ b/program.c @@ -100,14 +100,10 @@ uc_program_function_load(uc_program_t *prog, size_t id) size_t uc_program_function_srcpos(uc_function_t *fn, size_t off) { - size_t pos; - if (!fn) return 0; - pos = uc_chunk_debug_get_srcpos(&fn->chunk, off); - - return pos ? fn->srcpos + pos : 0; + return fn->srcpos + uc_chunk_debug_get_srcpos(&fn->chunk, off); } void -- cgit v1.2.3