Skip to content

Commit 5b2e8f0

Browse files
committed
[Profile] Handle binutils objdump RISC-V addresses
When regexing instructions for CFG targets, llvm-objdump outputs the immediates for branches like: bne a6, s9, 0xf33e <_foo+0x7d0> This we handle correctly with the current regex. However with binutils there are no spaces nor 0x prefix: bne a6,s9,f33e <_foo+0x8d0> This updates the regex to handle the binutils case by adding a specific non-capturing group for other non-immediate operands, (?:[^\\s]+,\\s*)* It also relaxes the immediate capture group to not require the 0x. parseInt seems to handle the detection of the base for us.
1 parent b20eb73 commit 5b2e8f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lnt/server/ui/static/lnt_profile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ InstructionSetParser.prototype = {
103103
RISCVJumpTargetRegexps: [
104104
// (regexp, noFallThru?)
105105
// branch conditional:
106-
[new RegExp("^\\s*b[a-z]+\\s+.*(0x[0-9a-f]+)\\s+<.+>"), false],
106+
[new RegExp("^\\s*b[a-z]+\\s+(?:[^\\s]+,\\s*)*([^\\s]+)\\s+<.+>"), false],
107107
// jumps:
108-
[new RegExp("^\\s*(?:jal|j|call|tail)\\s+.*(0x[0-9a-f]+)\\s+<.+>"), true],
108+
[new RegExp("^\\s*(?:jal|j|call|tail)\\s+(?:[^\\s]+,\\s*)*([^\\s]+)\\s+<.+>"), true],
109109
// indirect jumps:
110110
[new RegExp("^\\s*(?:jalr|jr|ret)"), true]
111111
],

0 commit comments

Comments
 (0)