Not yet enabled as the default unwinder but there are no known backtrace problems with the code at this point. Added 'log enable lldb unwind' to help diagnose backtrace problems; this output needs a little refining but it's a good first step. eh_frame information is currently read unconditionally - the code is structured to allow this to be delayed until it's actually needed. There is a performance hit when you have to parse the eh_frame information for any largeish executable/library so it's necessary to avoid if possible. It's confusing having both the UnwindPlan::RegisterLocation struct and the RegisterConextLLDB::RegisterLocation struct, I need to rename one of them. The writing of registers isn't done in the RegisterConextLLDB subclass yet; neither is the running of complex DWARF expressions from eh_frame (e.g. used for _sigtramp on Mac OS X). llvm-svn: 117256
71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
//===-- UnwindLLDB.h --------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef lldb_UnwindLLDB_h_
|
|
#define lldb_UnwindLLDB_h_
|
|
|
|
#include "lldb/lldb-private.h"
|
|
#include "lldb/Target/Unwind.h"
|
|
#include "lldb/Symbol/FuncUnwinders.h"
|
|
#include "lldb/Symbol/UnwindPlan.h"
|
|
#include "RegisterContextLLDB.h"
|
|
#include "lldb/Target/RegisterContext.h"
|
|
#include <vector>
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
class UnwindLLDB : public lldb_private::Unwind
|
|
{
|
|
public:
|
|
UnwindLLDB (lldb_private::Thread &thread);
|
|
|
|
virtual
|
|
~UnwindLLDB() { }
|
|
|
|
void
|
|
Clear()
|
|
{
|
|
m_frames.clear();
|
|
}
|
|
|
|
virtual uint32_t
|
|
GetFrameCount();
|
|
|
|
bool
|
|
GetFrameInfoAtIndex (uint32_t frame_idx,
|
|
lldb::addr_t& cfa,
|
|
lldb::addr_t& start_pc);
|
|
|
|
lldb_private::RegisterContext *
|
|
CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
|
|
|
|
private:
|
|
struct Cursor
|
|
{
|
|
lldb::addr_t start_pc; // The start address of the function/symbol for this frame - current pc if unknown
|
|
lldb::addr_t cfa; // The canonical frame address for this stack frame
|
|
lldb_private::SymbolContext sctx; // A symbol context we'll contribute to & provide to the StackFrame creation
|
|
lldb::RegisterContextSP reg_ctx; // These are all RegisterContextLLDB's
|
|
|
|
Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { }
|
|
};
|
|
|
|
std::vector<Cursor> m_frames;
|
|
|
|
//------------------------------------------------------------------
|
|
// For UnwindLLDB only
|
|
//------------------------------------------------------------------
|
|
DISALLOW_COPY_AND_ASSIGN (UnwindLLDB);
|
|
};
|
|
|
|
}
|
|
|
|
#endif // lldb_UnwindLLDB_h_
|