summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/FormatEntity.cpp
diff options
context:
space:
mode:
authorDawn Perchik <dawn@burble.org>2015-06-23 18:35:31 +0000
committerDawn Perchik <dawn@burble.org>2015-06-23 18:35:31 +0000
commitdc975670c194e0078d684546d49d06c661f163f7 (patch)
tree6034600f9bfa4cd047fb01f64a444e95e89bc343 /lldb/source/Core/FormatEntity.cpp
parentae3ac08326d6f22695eaca6c0a8bb22ab7ee40fc (diff)
downloadbcm5719-llvm-dc975670c194e0078d684546d49d06c661f163f7.tar.gz
bcm5719-llvm-dc975670c194e0078d684546d49d06c661f163f7.zip
Add support for displaying the language in the frame-format string.
Enable ${language} to be specified in the frame-format string to see the current frame's compile unit language in "frame info". Test Plan: debug a C++ program, run to main, and run the lldb commands: settings set frame-format "frame lang=${language}\n" frame info you should see: frame lang=c++ test case added in: ./dotest.py --executable lldb -f SettingsCommandTestCase.test_set_frame_format Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10561 llvm-svn: 240440
Diffstat (limited to 'lldb/source/Core/FormatEntity.cpp')
-rw-r--r--lldb/source/Core/FormatEntity.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index b1f28ae17c3..1dec0bfb97e 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Language.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamString.h"
@@ -210,6 +211,7 @@ static FormatEntity::Entry::Definition g_top_level_entries[] =
ENTRY_CHILDREN ("ansi" , Invalid , None , g_ansi_entries),
ENTRY ("current-pc-arrow" , CurrentPCArrow , CString ),
ENTRY_CHILDREN ("file" , File , CString , g_file_child_entries),
+ ENTRY ("language" , Lang , CString),
ENTRY_CHILDREN ("frame" , Invalid , None , g_frame_child_entries),
ENTRY_CHILDREN ("function" , Invalid , None , g_function_child_entries),
ENTRY_CHILDREN ("line" , Invalid , None , g_line_child_entries),
@@ -321,6 +323,7 @@ FormatEntity::Entry::TypeToCString (Type t)
ENUM_TO_CSTR(ScriptTarget);
ENUM_TO_CSTR(ModuleFile);
ENUM_TO_CSTR(File);
+ ENUM_TO_CSTR(Lang);
ENUM_TO_CSTR(FrameIndex);
ENUM_TO_CSTR(FrameRegisterPC);
ENUM_TO_CSTR(FrameRegisterSP);
@@ -1515,6 +1518,23 @@ FormatEntity::Format (const Entry &entry,
}
return false;
+ case Entry::Type::Lang:
+ if (sc)
+ {
+ CompileUnit *cu = sc->comp_unit;
+ if (cu)
+ {
+ Language lang(cu->GetLanguage());
+ const char *lang_name = lang.AsCString();
+ if (lang_name)
+ {
+ s.PutCString(lang_name);
+ return true;
+ }
+ }
+ }
+ return false;
+
case Entry::Type::FrameIndex:
if (exe_ctx)
{
OpenPOWER on IntegriCloud