mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
Add Visual Studio "map" file parser script ##r2js
This commit is contained in:
parent
8b3314ac79
commit
0da877ec63
29
scripts/vsmap.r2.js
Normal file
29
scripts/vsmap.r2.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/* parser for the msvc map files */
|
||||||
|
|
||||||
|
const mapFileName = "Sqlite3Console.map";
|
||||||
|
|
||||||
|
function filterFlag(symName) {
|
||||||
|
return "sym." + symName.replace(/[^a-zA-Z0-9]/g, '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadFlagsFromVsMap(fileName) {
|
||||||
|
const script = [];
|
||||||
|
const lines = r2.cmd("cat " + fileName).split("\n");
|
||||||
|
let publics = false;
|
||||||
|
for (const line of lines) {
|
||||||
|
if (!publics) {
|
||||||
|
if (line.indexOf("Publics") !== -1) {
|
||||||
|
publics = true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const [paddr, symName, symAddr, objName] = line.trim().split(/\s+/);
|
||||||
|
if (symName && symAddr) {
|
||||||
|
const flagName = filterFlag(symName);
|
||||||
|
script.push("'f " + flagName + " = 0x" + symAddr.replace(/^0+/g, ''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadFlagsFromVsMap(mapFileName).map(r2.cmd);
|
Loading…
Reference in New Issue
Block a user