[PATCH] D109575: [LNT] Fixed relative addresses parsing in ASM code

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 10 04:45:38 PDT 2021


kpdev42 updated this revision to Diff 371878.
kpdev42 added a comment.

Updated comment with to explain format of parsed address


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109575/new/

https://reviews.llvm.org/D109575

Files:
  lnt/server/ui/static/lnt_profile.js


Index: lnt/server/ui/static/lnt_profile.js
===================================================================
--- lnt/server/ui/static/lnt_profile.js
+++ lnt/server/ui/static/lnt_profile.js
@@ -122,7 +122,7 @@
                 if (!noFallThru && nextInstruction)
                     targets.push(nextInstruction.address);
                 if (match.length > 1)
-                    targets.push(cfg.convertToAddress(match[1]));
+                    targets.push(cfg.convertToAddress(match[1], instruction.address));
                 return [noFallThru, targets];
             }
         }
@@ -134,8 +134,13 @@
 CFG.prototype = {
     // The following method will have different implementations depending
     // on the profiler, or kind of profiling input.
-    convertToAddress: function (addressString) {
-      return parseInt(addressString, 16);
+    convertToAddress: function (addressString, addressCurrent) {
+      // If the address starts with '#' it is a relative one
+      // and should be processed differently
+      if (addressString.startsWith('#'))
+          return addressCurrent + parseInt(addressString.substring(1), 16);
+      else
+          return parseInt(addressString, 16);
     },
 
     parseDisassembly: function(counter) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109575.371878.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210910/758c8abf/attachment.bin>


More information about the llvm-commits mailing list