[llvm] r178859 - llvm-symbolizer: correctly parse filenames given in quotes
Alexey Samsonov
samsonov at google.com
Fri Apr 5 02:22:24 PDT 2013
Author: samsonov
Date: Fri Apr 5 04:22:24 2013
New Revision: 178859
URL: http://llvm.org/viewvc/llvm-project?rev=178859&view=rev
Log:
llvm-symbolizer: correctly parse filenames given in quotes
Added:
llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64 space
- copied unchanged from r178851, llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64
Removed:
llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64
Modified:
llvm/trunk/test/DebugInfo/dwarfdump-test.test
llvm/trunk/test/DebugInfo/llvm-symbolizer.test
llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
Removed: llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Inputs/dwarfdump-test3.elf-x86-64?rev=178858&view=auto
==============================================================================
Binary file - no diff available.
Modified: llvm/trunk/test/DebugInfo/dwarfdump-test.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-test.test?rev=178859&r1=178858&r2=178859&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-test.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-test.test Fri Apr 5 04:22:24 2013
@@ -8,11 +8,11 @@ RUN: llvm-dwarfdump %p/Inputs/dwarfdump-
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 \
Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=178859&r1=178858&r2=178859&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)
+++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Fri Apr 5 04:22:24 2013
@@ -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
Modified: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp?rev=178859&r1=178858&r2=178859&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp Fri Apr 5 04:22:24 2013
@@ -70,12 +70,25 @@ static bool parseCommand(bool &IsData, s
// 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;
More information about the llvm-commits
mailing list