summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-07-20 09:33:21 +0200
committerJo-Philipp Wich <jo@mein.io>2022-07-30 00:41:56 +0200
commit23224687205076604c1e0e5829690a5b6e150c06 (patch)
tree501bd568d44ff355a469bfddd27e8bec6da087e1
parent9c9a9ec383608287802bb2639a4ee6b7bbfd6793 (diff)
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 <jo@mein.io>
-rw-r--r--program.c6
1 files changed, 1 insertions, 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