diff --git a/lib/cfg.js b/lib/cfg.js index b128be1e3..32e6080b0 100644 --- a/lib/cfg.js +++ b/lib/cfg.js @@ -33,17 +33,17 @@ var InstructionType_conditionalJmpInst = 1; var InstructionType_notRetInst = 2; var InstructionType_retInst = 3; +var isFunctionName = function (x) { + return x.text.trim().indexOf('.') !== 0 && + !x.text.includes(' for ');// deal with typeinfo name for, typeinfo for, vtable for + }; + // this mess is intended to be ported to another file. function separateCodeFromData(asmArr) { var jmpLabelRegex = /\.L{1}\d+:/; - var isFunctionName = function (x) { - return !x.text.includes('.') && - !x.text.includes(' for ');// deal with typeinfo name for, typeinfo for, vtable for - }; - var isCode = function (x) { return x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || isFunctionName(x)); @@ -87,14 +87,10 @@ var gccX86 = { function separateCodeFromData_(asmArr) { var jmpLabelRegex = /\.LBB\d+_\d+:/; - var isFunctionName = function (x) { - var functionNameRegex = /((\w|\(|\))*): # @\1/; - return functionNameRegex.test(x); - }; - + var isCode = function (x) { return x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || - isFunctionName(x.text)); + isFunctionName(x)); }; var removeComments = function (x) {