Skip to content

Commit

Permalink
Adds check to see if operands line contains space between them (32-bit)
Browse files Browse the repository at this point in the history
otool on OS X 10.9 puts a space after comma between multiple operands.
otx was not processing this correctly resulting in omitted Obj-C
  • Loading branch information
bitst0rm authored and bitst0rm committed Apr 26, 2014
1 parent 9190c75 commit 933e662
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions source/Processors/Exe32Processor.m
Expand Up @@ -736,13 +736,37 @@ - (void)processCodeLine: (Line**)ioLine;
// remaining. Copy it, starting after the preceding tab.
if (consumedAfterOp && consumedAfterOp < theOrigLength - 1)
{
size_t origCommentLength = theOrigLength - consumedAfterOp - 1;

strncpy(theOrigCommentCString, (*ioLine)->chars + consumedAfterOp + 1,
origCommentLength);

// Add the null terminator.
theOrigCommentCString[origCommentLength - 1] = 0;
if (iLineOperandsCString[0] == '*' &&
(iLineOperandsCString[1] == '+' || iLineOperandsCString[1] == '-'))
{ // ObjC method call with whitespace
char dummyAddressCString[9] = {0};
char dummyMnemonicCString[20] = {0};

sscanf((*ioLine)->chars, "%s\t%s\t%[^\t\n]s", dummyAddressCString,
dummyMnemonicCString, iLineOperandsCString);
}
else {

size_t operandsCstringLength = strlen(iLineOperandsCString);
if (operandsCstringLength && iLineOperandsCString[operandsCstringLength-1]==','){
char dummyAddressCString[9] = {0};
char dummyMnemonicCString[20] = {0};


sscanf((*ioLine)->chars, "%s\t%s\t%[^\t\n]s", dummyAddressCString,
dummyMnemonicCString, iLineOperandsCString);
}
else // regular comment
{
size_t origCommentLength = theOrigLength - consumedAfterOp - 1;

strncpy(theOrigCommentCString, (*ioLine)->chars + consumedAfterOp + 1,
origCommentLength);

// Add the null terminator.
theOrigCommentCString[origCommentLength - 1] = 0;
}
}
}

char theCodeCString[32] = {0};
Expand Down

0 comments on commit 933e662

Please sign in to comment.