[nasm:debug-macros] macro debug: use rb_search_exact()
nasm-bot for H. Peter Anvin (Intel)
hpa at zytor.com
Thu Jul 9 17:51:06 PDT 2020
Commit-ID: 942092e32a2977d7261a1cd2a6d83f0ad7117e41
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=942092e32a2977d7261a1cd2a6d83f0ad7117e41
Author: H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Wed, 8 Jul 2020 09:53:49 -0700
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Wed, 8 Jul 2020 09:53:49 -0700
macro debug: use rb_search_exact()
We need the exact match in the rbtree for the current section. An
approximate match is not acceptable.
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
---
asm/assemble.c | 12 ++++++------
asm/preproc.c | 4 +++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/asm/assemble.c b/asm/assemble.c
index 1093f4dd..2843a84b 100644
--- a/asm/assemble.c
+++ b/asm/assemble.c
@@ -427,12 +427,6 @@ static void out(struct out_data *data)
if (src_get(&lineno, &lnfname))
dfmt->linenum(lnfname, lineno, data->segment);
- /*
- * Collect macro-related information for the debugger, if applicable
- */
- if (debug_current_macro)
- debug_macro_out(data);
-
if (asize > amax) {
if (data->type == OUT_RELADDR || data->sign == OUT_SIGNED) {
nasm_nonfatal("%u-bit signed relocation unsupported by output format %s",
@@ -455,6 +449,12 @@ static void out(struct out_data *data)
lfmt->output(data);
if (likely(data->segment != NO_SEG)) {
+ /*
+ * Collect macro-related information for the debugger, if applicable
+ */
+ if (debug_current_macro)
+ debug_macro_out(data);
+
ofmt->output(data);
} else {
/* Outputting to ABSOLUTE section - only reserve is permitted */
diff --git a/asm/preproc.c b/asm/preproc.c
index 87e03470..9d95e67e 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -6137,12 +6137,14 @@ static struct debug_macro_addr *
debug_macro_get_addr_inv(int32_t seg, struct debug_macro_inv *inv)
{
struct debug_macro_addr *addr;
+ static_assert(offsetof(struct debug_macro_addr, tree) == 0);
if (likely(seg == inv->lastseg))
return inv->addr.last;
inv->lastseg = seg;
- addr = (struct debug_macro_addr *)rb_search(inv->addr.tree, seg);
+ addr = (struct debug_macro_addr *)
+ rb_search_exact(inv->addr.tree, seg);
if (unlikely(!addr)) {
nasm_new(addr);
addr->tree.key = seg;
More information about the Nasm-commits
mailing list