[PATCH] D110174: [LNT] Determine base for asm address
Pavel Kosov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 21 07:07:41 PDT 2021
kpdev42 created this revision.
kpdev42 added a reviewer: tnfchris.
kpdev42 added a project: LLVM.
Herald added a subscriber: dkolesnichenko.
kpdev42 requested review of this revision.
It is better to avoid hardcode for hex and dec while parsing asm addresses
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110174
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
@@ -137,10 +137,13 @@
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), 10);
+ var isRelative = addressString.startsWith('#');
+ var charOffset = (isRelative ? 1 : 0);
+ var base = (addressString.substring(charOffset).startsWith('0x') ? 16 : 10);
+ if (isRelative)
+ return addressCurrent + parseInt(addressString.substring(1), base);
else
- return parseInt(addressString, 16);
+ return parseInt(addressString, base);
},
parseDisassembly: function(counter) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110174.373911.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210921/b5ea62f2/attachment.bin>
More information about the llvm-commits
mailing list