diff options
author | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-17 00:26:30 +0000 |
---|---|---|
committer | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-17 00:26:30 +0000 |
commit | 3cf443ddd63fa219f3681ec3ca837cc1c0dc0829 (patch) | |
tree | 41474f4cf6264ad8af717f0bdec6a71714c7ec3a /lldb/source/Host/linux/Host.cpp | |
parent | dfb7687162d9e19313d4bf97a68324d2221a3a36 (diff) | |
download | bcm5719-llvm-3cf443ddd63fa219f3681ec3ca837cc1c0dc0829.tar.gz bcm5719-llvm-3cf443ddd63fa219f3681ec3ca837cc1c0dc0829.zip |
simple plugin now works with Linux fix assert in SetPluginInfo implement Linux ePathTypeLLDBSystemPlugins and ePathTypeLLDBUserPlugins implement Linux Host::Backtrace and Host::GetEnvironment add .gnu_debugdata comment
Differential Revision: http://llvm-reviews.chandlerc.com/D1159
llvm-svn: 186475
Diffstat (limited to 'lldb/source/Host/linux/Host.cpp')
-rw-r--r-- | lldb/source/Host/linux/Host.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index ef3c9fbf06f..a756a47ffa8 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -14,6 +14,7 @@ #include <sys/stat.h> #include <dirent.h> #include <fcntl.h> +#include <execinfo.h> // C++ Includes // Other libraries and framework includes @@ -509,12 +510,28 @@ Host::GetThreadName (lldb::pid_t pid, lldb::tid_t tid) void Host::Backtrace (Stream &strm, uint32_t max_frames) { - // TODO: Is there a way to backtrace the current process on linux? + if (max_frames > 0) + { + std::vector<void *> frame_buffer (max_frames, NULL); + int num_frames = ::backtrace (&frame_buffer[0], frame_buffer.size()); + char** strs = ::backtrace_symbols (&frame_buffer[0], num_frames); + if (strs) + { + // Start at 1 to skip the "Host::Backtrace" frame + for (int i = 1; i < num_frames; ++i) + strm.Printf("%s\n", strs[i]); + ::free (strs); + } + } } size_t Host::GetEnvironment (StringList &env) { - // TODO: Is there a way to the host environment for this process on linux? - return 0; + char **host_env = environ; + char *env_entry; + size_t i; + for (i=0; (env_entry = host_env[i]) != NULL; ++i) + env.AppendString(env_entry); + return i; } |