mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
llvm-symbolizer: correctly parse filenames given in quotes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178859 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -70,12 +70,25 @@ static bool parseCommand(bool &IsData, std::string &ModuleName,
|
||||
// If no cmd, assume it's CODE.
|
||||
IsData = false;
|
||||
}
|
||||
// FIXME: Handle case when filename is given in quotes.
|
||||
if (char *FilePath = strtok(pos, kDelimiters)) {
|
||||
ModuleName = FilePath;
|
||||
if (char *OffsetStr = strtok((char *)0, kDelimiters))
|
||||
ModuleOffsetStr = OffsetStr;
|
||||
// Skip delimiters and parse input filename.
|
||||
pos += strspn(pos, kDelimiters);
|
||||
if (*pos == '"' || *pos == '\'') {
|
||||
char quote = *pos;
|
||||
pos++;
|
||||
char *end = strchr(pos, quote);
|
||||
if (end == 0)
|
||||
return false;
|
||||
ModuleName = std::string(pos, end - pos);
|
||||
pos = end + 1;
|
||||
} else {
|
||||
int name_length = strcspn(pos, kDelimiters);
|
||||
ModuleName = std::string(pos, name_length);
|
||||
pos += name_length;
|
||||
}
|
||||
// Skip delimiters and parse module offset.
|
||||
pos += strspn(pos, kDelimiters);
|
||||
int offset_length = strcspn(pos, kDelimiters);
|
||||
ModuleOffsetStr = std::string(pos, offset_length);
|
||||
if (StringRef(ModuleOffsetStr).getAsInteger(0, ModuleOffset))
|
||||
return false;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user