Skip to content

Commit

Permalink
elf-core: Add FreeBSD signals
Browse files Browse the repository at this point in the history
Sponsored by: DARPA, AFRL
Differential Revision: http://reviews.llvm.org/D3401

llvm-svn: 206469
  • Loading branch information
emaste committed Apr 17, 2014
1 parent 41736e3 commit 94ba368
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -105,6 +106,8 @@ ProcessElfCore::ProcessElfCore(Target& target, Listener &listener,
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 ()
Expand Down Expand Up @@ -229,6 +232,15 @@ ProcessElfCore::DoLoadCore ()
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;
}

Expand Down Expand Up @@ -342,6 +354,8 @@ void
ProcessElfCore::Clear()
{
m_thread_list.Clear();
m_os = llvm::Triple::UnknownOS;
m_signals_sp.reset();
}

void
Expand Down Expand Up @@ -486,6 +500,7 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader *
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:
Expand Down
15 changes: 15 additions & 0 deletions lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
Expand Up @@ -103,6 +103,18 @@ class ProcessElfCore : public lldb_private::Process
virtual bool
IsAlive ();

//------------------------------------------------------------------
// Process Signals
//------------------------------------------------------------------
virtual lldb_private::UnixSignals &
GetUnixSignals()
{
if (m_signals_sp)
return *m_signals_sp;
else
return Process::GetUnixSignals();
}

//------------------------------------------------------------------
// Process Memory
//------------------------------------------------------------------
Expand Down Expand Up @@ -142,6 +154,9 @@ class ProcessElfCore : public lldb_private::Process
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;

Expand Down

0 comments on commit 94ba368

Please sign in to comment.