[Lldb-commits] [PATCH] Add FreeBSD-specific signal support to elf-core
Ed Maste
emaste at freebsd.org
Wed Apr 16 11:11:20 PDT 2014
Right now elf-core supports only the generic signal set. Override GetUnixSignals in ProcessElfCore, and return the OS-specific signal set, if we have one.
This requires a trivial change to move FreeBSDSignals to Plugins/Process/Utility, not shown in this diff. The equivalent change to support Linux signals in elf-core is straightforward, but we don't (yet) identify Linux cores in a foolproof way.
http://reviews.llvm.org/D3401
Files:
source/Plugins/Process/elf-core/ProcessElfCore.cpp
source/Plugins/Process/elf-core/ProcessElfCore.h
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===================================================================
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -25,6 +25,7 @@
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
+#include "Plugins/Process/Utility/FreeBSDSignals.h"
// Project includes
#include "ProcessElfCore.h"
@@ -105,6 +106,8 @@
m_core_module_sp (),
m_core_file (core_file),
m_dyld_plugin_name (),
+ m_os(llvm::Triple::UnknownOS),
+ m_signals_sp (),
m_thread_data_valid(false),
m_thread_data(),
m_core_aranges ()
@@ -229,6 +232,15 @@
if (arch.IsValid())
m_target.SetArchitecture(arch);
+ switch (m_os)
+ {
+ case llvm::Triple::FreeBSD:
+ m_signals_sp.reset(new FreeBSDSignals());
+ break;
+ default:
+ break;
+ }
+
return error;
}
@@ -342,6 +354,8 @@
ProcessElfCore::Clear()
{
m_thread_list.Clear();
+ m_os = llvm::Triple::UnknownOS;
+ m_signals_sp.reset();
}
void
@@ -486,6 +500,7 @@
DataExtractor note_data (segment_data, note_start, note_size);
if (note.n_name == "FreeBSD")
{
+ m_os = llvm::Triple::FreeBSD;
switch (note.n_type)
{
case NT_FREEBSD_PRSTATUS:
Index: source/Plugins/Process/elf-core/ProcessElfCore.h
===================================================================
--- source/Plugins/Process/elf-core/ProcessElfCore.h
+++ source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -104,6 +104,18 @@
IsAlive ();
//------------------------------------------------------------------
+ // Process Signals
+ //------------------------------------------------------------------
+ virtual lldb_private::UnixSignals &
+ GetUnixSignals()
+ {
+ if (m_signals_sp)
+ return *m_signals_sp;
+ else
+ return Process::GetUnixSignals();
+ }
+
+ //------------------------------------------------------------------
// Process Memory
//------------------------------------------------------------------
virtual size_t
@@ -142,6 +154,9 @@
std::string m_dyld_plugin_name;
DISALLOW_COPY_AND_ASSIGN (ProcessElfCore);
+ llvm::Triple::OSType m_os;
+ std::shared_ptr<lldb_private::UnixSignals> m_signals_sp;
+
// True if m_thread_contexts contains valid entries
bool m_thread_data_valid;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3401.1.patch
Type: text/x-patch
Size: 2577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140416/4dfc99d2/attachment.bin>
More information about the lldb-commits
mailing list