Skip to content

Commit 003fda7

Browse files
author
Pavel Kosov
committed
[LNT] Fixed relative addresses parsing in ASM code
Fixed relative addresses parsing in ASM code for Control Flow Graph on the Profile page Reviewed By: thopre Differential Revision: https://reviews.llvm.org/D109575
1 parent 3bb8ff8 commit 003fda7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lnt/server/ui/static/lnt_profile.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ InstructionSetParser.prototype = {
122122
if (!noFallThru && nextInstruction)
123123
targets.push(nextInstruction.address);
124124
if (match.length > 1)
125-
targets.push(cfg.convertToAddress(match[1]));
125+
targets.push(cfg.convertToAddress(match[1], instruction.address));
126126
return [noFallThru, targets];
127127
}
128128
}
@@ -134,8 +134,13 @@ InstructionSetParser.prototype = {
134134
CFG.prototype = {
135135
// The following method will have different implementations depending
136136
// on the profiler, or kind of profiling input.
137-
convertToAddress: function (addressString) {
138-
return parseInt(addressString, 16);
137+
convertToAddress: function (addressString, addressCurrent) {
138+
// If the address starts with '#' it is a relative one
139+
// and should be processed differently
140+
if (addressString.startsWith('#'))
141+
return addressCurrent + parseInt(addressString.substring(1), 16);
142+
else
143+
return parseInt(addressString, 16);
139144
},
140145

141146
parseDisassembly: function(counter) {

0 commit comments

Comments
 (0)