mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
llvm-symbolizer: correctly parse filenames given in quotes
llvm-svn: 178859
This commit is contained in:
parent
c2465d2e7e
commit
5cf62b262f
@ -8,11 +8,11 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test2.elf-x86-64 \
|
||||
RUN: --address=0x4004e8 --functions | FileCheck %s -check-prefix MANY_CU_1
|
||||
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test2.elf-x86-64 \
|
||||
RUN: --address=0x4004f4 --functions | FileCheck %s -check-prefix MANY_CU_2
|
||||
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test3.elf-x86-64 \
|
||||
RUN: llvm-dwarfdump "%p/Inputs/dwarfdump-test3.elf-x86-64 space" \
|
||||
RUN: --address=0x640 --functions | FileCheck %s -check-prefix ABS_ORIGIN_1
|
||||
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test3.elf-x86-64 \
|
||||
RUN: llvm-dwarfdump "%p/Inputs/dwarfdump-test3.elf-x86-64 space" \
|
||||
RUN: --address=0x633 --functions | FileCheck %s -check-prefix INCLUDE_TEST_1
|
||||
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test3.elf-x86-64 \
|
||||
RUN: llvm-dwarfdump "%p/Inputs/dwarfdump-test3.elf-x86-64 space" \
|
||||
RUN: --address=0x62d --functions | FileCheck %s -check-prefix INCLUDE_TEST_2
|
||||
RUN: llvm-dwarfdump %p/Inputs/dwarfdump-test4.elf-x86-64 \
|
||||
RUN: --address=0x62c --functions \
|
||||
|
@ -1,6 +1,7 @@
|
||||
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x400559" > %t.input
|
||||
RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input
|
||||
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x710" >> %t.input
|
||||
RUN: echo '"%p/Inputs/dwarfdump-test3.elf-x86-64 space" 0x633' >> %t.input
|
||||
|
||||
RUN: llvm-symbolizer --functions --inlining --demangle=false < %t.input \
|
||||
RUN: | FileCheck %s
|
||||
@ -18,4 +19,7 @@ CHECK-NEXT: dwarfdump-inl-test.h:7
|
||||
CHECK-NEXT: inlined_f
|
||||
CHECK-NEXT: dwarfdump-inl-test.cc:3
|
||||
CHECK-NEXT: main
|
||||
CHECK-NEXT: dwarfdump-inl-test.cc:8
|
||||
CHECK-NEXT: dwarfdump-inl-test.cc:
|
||||
|
||||
CHECK: _Z3do1v
|
||||
CHECK-NEXT: dwarfdump-test3-decl.h:7
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user