summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-09-05 23:52:08 +0000
committerAdrian Prantl <aprantl@apple.com>2018-09-05 23:52:08 +0000
commit4954f6a565d158b90868f137ce2959eabbbe98f4 (patch)
tree5d8122ca5beb8550c0de7429042ac50a1f1bf5df
parent9ec23049a76cef425e3978e617cd3aaf2f8d2fd3 (diff)
downloadbcm5719-llvm-4954f6a565d158b90868f137ce2959eabbbe98f4.tar.gz
bcm5719-llvm-4954f6a565d158b90868f137ce2959eabbbe98f4.zip
Print column info in backtraces et al. if available
This patch allows LLDB to print column info in backtraces et al. if available, which is useful when the backtrace contains a frame like the following: f(can_crash(0), can_crash(1)); Differential Revision: https://reviews.llvm.org/D51661 llvm-svn: 341506
-rw-r--r--lldb/include/lldb/Core/FormatEntity.h1
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/asan/Makefile2
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py3
-rw-r--r--lldb/source/Core/Debugger.cpp3
-rw-r--r--lldb/source/Core/FormatEntity.cpp12
5 files changed, 18 insertions, 3 deletions
diff --git a/lldb/include/lldb/Core/FormatEntity.h b/lldb/include/lldb/Core/FormatEntity.h
index 93c7b3a94e4..1e5277e6fe5 100644
--- a/lldb/include/lldb/Core/FormatEntity.h
+++ b/lldb/include/lldb/Core/FormatEntity.h
@@ -104,6 +104,7 @@ public:
FunctionIsOptimized,
LineEntryFile,
LineEntryLineNumber,
+ LineEntryColumn,
LineEntryStartAddress,
LineEntryEndAddress,
CurrentPCArrow
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/asan/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/asan/Makefile
index 26654a023ed..dc8d682f831 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/asan/Makefile
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/asan/Makefile
@@ -1,6 +1,6 @@
LEVEL = ../../make
C_SOURCES := main.c
-CFLAGS_EXTRAS := -fsanitize=address -g
+CFLAGS_EXTRAS := -fsanitize=address -g -gcolumn-info
include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py b/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
index d7c51102186..ca070fa97df 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
@@ -37,6 +37,7 @@ class AsanTestReportDataCase(TestBase):
self.line_free = line_number('main.c', '// free line')
self.line_breakpoint = line_number('main.c', '// break line')
self.line_crash = line_number('main.c', '// BOOM line')
+ self.col_crash = 16
def asan_tests(self):
exe = self.getBuildArtifact("a.out")
@@ -63,7 +64,7 @@ class AsanTestReportDataCase(TestBase):
lldb.eStopReasonInstrumentation)
self.expect("bt", "The backtrace should show the crashing line",
- substrs=['main.c:%d' % self.line_crash])
+ substrs=['main.c:%d:%d' % (self.line_crash, self.col_crash)])
self.expect(
"thread info -s",
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 17bec036564..2fd7ff4e5ec 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -121,7 +121,8 @@ OptionEnumValueElement g_language_enumerators[] = {
"${module.file.basename}{`${function.name-without-args}" \
"{${frame.no-debug}${function.pc-offset}}}}"
-#define FILE_AND_LINE "{ at ${line.file.basename}:${line.number}}"
+#define FILE_AND_LINE \
+ "{ at ${line.file.basename}:${line.number}{:${line.column}}}"
#define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
#define DEFAULT_THREAD_FORMAT \
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index bfaf5a0e007..977effcac8f 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -146,6 +146,7 @@ static FormatEntity::Entry::Definition g_function_child_entries[] = {
static FormatEntity::Entry::Definition g_line_child_entries[] = {
ENTRY_CHILDREN("file", LineEntryFile, None, g_file_child_entries),
ENTRY("number", LineEntryLineNumber, UInt32),
+ ENTRY("column", LineEntryColumn, UInt32),
ENTRY("start-addr", LineEntryStartAddress, UInt64),
ENTRY("end-addr", LineEntryEndAddress, UInt64),
};
@@ -372,6 +373,7 @@ const char *FormatEntity::Entry::TypeToCString(Type t) {
ENUM_TO_CSTR(FunctionIsOptimized);
ENUM_TO_CSTR(LineEntryFile);
ENUM_TO_CSTR(LineEntryLineNumber);
+ ENUM_TO_CSTR(LineEntryColumn);
ENUM_TO_CSTR(LineEntryStartAddress);
ENUM_TO_CSTR(LineEntryEndAddress);
ENUM_TO_CSTR(CurrentPCArrow);
@@ -1814,6 +1816,16 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
}
return false;
+ case Entry::Type::LineEntryColumn:
+ if (sc && sc->line_entry.IsValid() && sc->line_entry.column) {
+ const char *format = "%" PRIu32;
+ if (!entry.printf_format.empty())
+ format = entry.printf_format.c_str();
+ s.Printf(format, sc->line_entry.column);
+ return true;
+ }
+ return false;
+
case Entry::Type::LineEntryStartAddress:
case Entry::Type::LineEntryEndAddress:
if (sc && sc->line_entry.range.GetBaseAddress().IsValid()) {
OpenPOWER on IntegriCloud