[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 01:06:00 PDT 2021


kpdev42 created this revision.
kpdev42 added reviewers: cmatthews, thopre, danilaml.
kpdev42 added a project: LLVM.
Herald added a subscriber: dkolesnichenko.
kpdev42 requested review of this revision.

Fixed relative addresses parsing in ASM code for Control Flow Graph on the Profile page


Repository:
  rG LLVM Github Monorepo

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,11 @@
 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 (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.371807.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210910/14f8b367/attachment.bin>


More information about the llvm-commits mailing list