Repository navigation
internal/report: include the last byte in disassembly - #1034
Conversation
|
Does this also warrant any function-level documentation updates somewhere? Do we clearly document the inclusivity-exclusivity everywhere we should? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1034 +/- ##
==========================================
+ Coverage 67.43% 68.31% +0.87%
==========================================
Files 45 45
Lines 7868 7871 +3
==========================================
+ Hits 5306 5377 +71
+ Misses 2118 2046 -72
- Partials 444 448 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Yes. I made the bounds explicit in both the public and internal object-tool APIs: symbols include both endpoints, while disassembly includes the start and excludes the end. I also documented those bounds on the implementation and sample-to-symbol classification. No executable code changed in this follow-up. The existing final-byte regression cases and disassembly tests pass on Linux, and gofmt reports no changes. |
|
@aalexand The function-level bounds documentation is included at current head Could a maintainer authorize the pending runs when reviewing? The same approval gate currently holds the other three small fixes (#1032, #1033, #1035); their requested test consolidation/screenshots and recorded validation are in their respective PRs. I am consolidating the request here rather than posting four identical reminders. No CI-policy changes or approval bypass are proposed. |
Sym.Endincludes the final byte, whileObjTool.Disasmtakes an exclusive end. Passing the symbol end directly omitted the final instruction; the sample filter also discarded samples at that address, including all samples for a one-byte symbol.Convert bounded symbol ends to exclusive disassembly limits and include the endpoint when collecting samples. Preserve the unknown end of the final
nmsymbol without overflowing. Regression tests cover the last instruction, endpoint samples, one-byte symbols, and the unknown-end sentinel, and verify that the next symbol is excluded.Fixes #450.
Validation on Linux (Go 1.26.7):
go test ./... -count=1go test -race ./internal/report -count=1go vet -all ./...(cd browsertests && go test ./... -count=1)I also reproduced the issue through the CLI using a real ELF with adjacent
NOP; RETandRETfunctions: the original report showed only the first instruction and 1 of 8 samples; the fix includes the finalRETand all 8 samples. The regression suite fails when either endpoint fix is reverted and when the unknown-end guard is removed.