aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2023-02-14 18:13:59 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-02-14 18:20:13 -0300
commit1231b6b9b4d88e0084bef4254eb1a05eb9935c99 (patch)
treece978f77ffacab307f889edd19f74c5ca0474d6a
parentc4eb1897d1f3841d291ee39dc969c4212750cf2c (diff)
downloadpahole-1231b6b9b4d88e0084bef4254eb1a05eb9935c99.tar.gz
dwarf_loader: Fix sorting of Rust structs
We may have structs with fields on the same offset, don't move anything in that case, otherwise we get into an eternal loop, doh. Tested with the Linux kernel built with CONFIG_RUST + all the code examples, first Rust struct where this happened was: (gdb) p type->namespace.name $2 = 0x7fffda938497 "((), char)" (gdb) p type->nr_members $3 = 2 (gdb) p current_member->name $4 = 0x7fffda918f36 "__1" (gdb) p next_member->name $5 = 0x7fffda91765c "__0" (gdb) p current_member->byte_offset $6 = 0 (gdb) p next_member->byte_offset $7 = 0 But this shows that --lang_exclude should be better positioned as we're now needlessly loading all the tags for Rust DWARF to then just trow it away at the cu__filter() in pahole :-\ Too late in the 1.25 release cycle for that, optimize it in 1.26. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--dwarf_loader.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dwarf_loader.c b/dwarf_loader.c
index a77598dc..acdb68d5 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -2857,7 +2857,7 @@ restart:
struct class_member *next_member = list_entry(current_member->tag.node.next, typeof(*current_member), tag.node);
- if (current_member->byte_offset < next_member->byte_offset)
+ if (current_member->byte_offset <= next_member->byte_offset)
continue;
list_del(&current_member->tag.node);