[Lldb-commits] [lldb] r118240 - in /lldb/trunk: include/lldb/Symbol/ source/Commands/ source/Plugins/Disassembler/llvm/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Symbol/
Jason Molenda
jmolenda at apple.com
Thu Nov 4 02:40:56 PDT 2010
Author: jmolenda
Date: Thu Nov 4 04:40:56 2010
New Revision: 118240
URL: http://llvm.org/viewvc/llvm-project?rev=118240&view=rev
Log:
Built the native unwinder with all the warnings c++-4.2 could muster;
fixed them. Added DISALLOW_COPY_AND_ASSIGN to classes that should
not be bitwise copied. Added default initializers for member
variables that weren't being initialized in the ctor. Fixed a few
shadowed local variable mistakes.
Modified:
lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
lldb/trunk/include/lldb/Symbol/UnwindPlan.h
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
lldb/trunk/source/Symbol/FuncUnwinders.cpp
Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Thu Nov 4 04:40:56 2010
@@ -70,7 +70,9 @@
uint8_t ptr_encoding;
lldb_private::UnwindPlan::Row initial_row;
- CIE(dw_offset_t offset) : cie_offset(offset), initial_row() {}
+ CIE(dw_offset_t offset) : cie_offset(offset), initial_row(), version (-1),
+ code_align (0), data_align (0), return_addr_reg_num (-1),
+ inst_offset (0), inst_length (0), ptr_encoding (0) {}
};
typedef lldb::SharedPtr<CIE>::Type CIESP;
@@ -80,6 +82,8 @@
AddressRange bounds; // function bounds
dw_offset_t offset; // offset to this FDE within the Section
+ FDEEntry () : offset (0), bounds () { }
+
inline bool
operator<(const DWARFCallFrameInfo::FDEEntry& b) const
{
Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original)
+++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Thu Nov 4 04:40:56 2010
@@ -74,6 +74,8 @@
Address m_first_non_prologue_insn;
+ DISALLOW_COPY_AND_ASSIGN (FuncUnwinders);
+
}; // class FuncUnwinders
inline bool
Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindPlan.h?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/UnwindPlan.h (original)
+++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h Thu Nov 4 04:40:56 2010
@@ -59,7 +59,7 @@
isDWARFExpression // reg = eval(dwarf_expr)
};
- RegisterLocation() : m_type(unspecified) { }
+ RegisterLocation() : m_type(unspecified), m_location() { }
bool
operator == (const RegisterLocation& rhs) const;
@@ -175,8 +175,8 @@
}
// Return the number of registers we have locations for
- int
- GetRegisterCount () const
+ int
+ GetRegisterCount () const
{
return m_register_locations.size();
}
Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Thu Nov 4 04:40:56 2010
@@ -21,11 +21,19 @@
#include "lldb/Core/Disassembler.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Core/SourceManager.h"
+#include "lldb/Core/Stream.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Symbol/FuncUnwinders.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Symbol/DWARFCallFrameInfo.h"
+#include "lldb/Utility/ArchVolatileRegs.h"
+
#define DEFAULT_DISASM_BYTE_SIZE 32
using namespace lldb;
@@ -252,7 +260,46 @@
// The default action is to disassemble the current frame function.
if (exe_ctx.frame)
{
- SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
+// SymbolContext sc(exe_ctx.frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
+ SymbolContext sc(exe_ctx.frame->GetSymbolContext (eSymbolContextEverything));
+
+ ArchVolatileRegs *vr = ArchVolatileRegs::FindPlugin (exe_ctx.target->GetArchitecture());
+ Address pc = exe_ctx.frame->GetFrameCodeAddress();
+ FuncUnwindersSP fu = pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (pc, sc);
+ if (fu != NULL)
+ {
+
+ Address first_non_prologue_insn = fu->GetFirstNonPrologueInsn (*exe_ctx.target);
+ UnwindPlan *up = fu->GetUnwindPlanAtCallSite();
+ Stream *s = &result.GetOutputStream();
+ if (up)
+ {
+ s->Printf ("\nJSMDEBUG: unwind plan at call site (from eh_frame)\n");
+ up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread());
+ }
+ else
+ {
+ result.GetOutputStream().Printf("No UnwindPlanAtCallSite available.\n");
+ }
+ up = fu->GetUnwindPlanAtNonCallSite(exe_ctx.frame->GetThread());
+ s->Printf ("\nJSMDEBUG: unwind plan at non-call site (from disassembly)\n");
+ up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread());
+
+ up = fu->GetUnwindPlanFastUnwind(exe_ctx.frame->GetThread());
+ if (up)
+ {
+ s->Printf ("\nJSMDEBUG: fast unwind plan\n");
+ up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread());
+ }
+
+ up = fu->GetUnwindPlanArchitectureDefault(exe_ctx.frame->GetThread());
+ if (up)
+ {
+ s->Printf ("\nJSMDEBUG: architectural default unwind plan\n");
+ up->Dump (result.GetOutputStream(), &exe_ctx.frame->GetThread());
+ }
+ }
+
if (sc.function)
range = sc.function->GetAddressRange();
else if (sc.symbol && sc.symbol->GetAddressRangePtr())
Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Thu Nov 4 04:40:56 2010
@@ -362,6 +362,7 @@
((strcasestr (arch_name, "i386") == arch_name) ||
(strcasestr (arch_name, "x86_64") == arch_name)))
return kEDAssemblySyntaxX86ATT;
+printf ("JSMDEBUG: Warning returning 'default' as the assembly syntax style\n");
return (EDAssemblySyntax_t)0; // default
}
@@ -382,6 +383,10 @@
char triple[256];
if (TripleForArchSpec (arch, triple, sizeof(triple)))
{
+printf ("JSMDEBUG: Getting disassembler for triple %s\n", triple);
+if (strcmp (triple, "x86_64-unknown-unknown") == 0)
+ strcpy (triple, "x86_64-apple-darwin");
+printf ("JSMDEBUG: Getting disassembler for triple fixed %s\n", triple);
assert(!EDGetDisassembler(&m_disassembler, triple, SyntaxForArchSpec (arch)) && "No disassembler created!");
}
}
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Thu Nov 4 04:40:56 2010
@@ -34,7 +34,8 @@
RegisterContext (thread), m_thread(thread), m_next_frame(next_frame),
m_sym_ctx(sym_ctx), m_all_registers_available(false), m_registers(),
m_cfa (LLDB_INVALID_ADDRESS), m_start_pc (), m_current_pc (), m_frame_number (frame_number),
- m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL)
+ m_full_unwind_plan(NULL), m_fast_unwind_plan(NULL), m_base_reg_ctx (), m_frame_type (-1),
+ m_current_offset (0), m_sym_ctx_valid (false)
{
m_sym_ctx.Clear();
m_sym_ctx_valid = false;
@@ -498,7 +499,7 @@
if (m_frame_type == eSigtrampFrame)
{
m_fast_unwind_plan = NULL;
- UnwindPlan *up = fu->GetUnwindPlanAtCallSite ();
+ up = fu->GetUnwindPlanAtCallSite ();
if (up->PlanValidAtAddress (m_current_pc))
{
return up;
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp Thu Nov 4 04:40:56 2010
@@ -162,10 +162,15 @@
int m_wordsize;
int m_cpu;
+
+ DISALLOW_COPY_AND_ASSIGN (AssemblyParse_x86);
};
AssemblyParse_x86::AssemblyParse_x86 (Target& target, Thread* thread, int cpu, AddressRange func) :
- m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func)
+ m_target (target), m_thread (thread), m_cpu(cpu), m_func_bounds(func),
+ m_machine_ip_regnum (-1), m_machine_sp_regnum (-1), m_machine_fp_regnum (-1),
+ m_lldb_ip_regnum (-1), m_lldb_sp_regnum (-1), m_lldb_fp_regnum (-1),
+ m_wordsize (-1), m_cur_insn ()
{
int *initialized_flag = NULL;
m_lldb_ip_regnum = m_lldb_sp_regnum = m_lldb_fp_regnum = -1;
@@ -519,7 +524,7 @@
m_cur_insn = m_func_bounds.GetBaseAddress ();
int current_func_text_offset = 0;
int current_sp_bytes_offset_from_cfa = 0;
- UnwindPlan::Row::RegisterLocation regloc;
+ UnwindPlan::Row::RegisterLocation initial_regloc;
if (!m_cur_insn.IsValid())
{
@@ -535,13 +540,13 @@
row.SetCFAOffset (m_wordsize);
// caller's stack pointer value before the call insn is the CFA address
- regloc.SetIsCFAPlusOffset (0);
- row.SetRegisterInfo (m_lldb_sp_regnum, regloc);
+ initial_regloc.SetIsCFAPlusOffset (0);
+ row.SetRegisterInfo (m_lldb_sp_regnum, initial_regloc);
// saved instruction pointer can be found at CFA - wordsize.
current_sp_bytes_offset_from_cfa = m_wordsize;
- regloc.SetAtCFAPlusOffset (-current_sp_bytes_offset_from_cfa);
- row.SetRegisterInfo (m_lldb_ip_regnum, regloc);
+ initial_regloc.SetAtCFAPlusOffset (-current_sp_bytes_offset_from_cfa);
+ row.SetRegisterInfo (m_lldb_ip_regnum, initial_regloc);
unwind_plan.AppendRow (row);
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Thu Nov 4 04:40:56 2010
@@ -35,7 +35,7 @@
if (m_frames.empty())
{
// First, set up the 0th (initial) frame
- CursorSP first_cursor_sp(new Cursor);
+ CursorSP first_cursor_sp(new Cursor ());
RegisterContextSP no_frame; // an empty shared pointer
RegisterContextLLDB *first_register_ctx = new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0);
if (!first_register_ctx->IsValid())
@@ -55,16 +55,16 @@
}
// Reuse the StackFrame provided by the processor native machine context for the first frame
first_register_ctx->SetStackFrame (m_thread.GetStackFrameAtIndex(0).get());
- RegisterContextSP temp_rcs(first_register_ctx);
- first_cursor_sp->reg_ctx = temp_rcs;
+ RegisterContextSP first_register_ctx_sp(first_register_ctx);
+ first_cursor_sp->reg_ctx = first_register_ctx_sp;
m_frames.push_back (first_cursor_sp);
// Now walk up the rest of the stack
while (1)
{
- CursorSP cursor_sp(new Cursor);
+ CursorSP cursor_sp(new Cursor ());
RegisterContextLLDB *register_ctx;
- int cur_idx = m_frames.size ();
+ uint32_t cur_idx = m_frames.size ();
register_ctx = new RegisterContextLLDB (m_thread, m_frames[cur_idx - 1]->reg_ctx, cursor_sp->sctx, cur_idx);
if (!register_ctx->IsValid())
{
@@ -106,10 +106,10 @@
}
break;
}
- RegisterContextSP temp_rcs(register_ctx);
- StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, temp_rcs, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx));
+ RegisterContextSP register_ctx_sp(register_ctx);
+ StackFrame *frame = new StackFrame(cur_idx, cur_idx, m_thread, register_ctx_sp, cursor_sp->cfa, cursor_sp->start_pc, &(cursor_sp->sctx));
register_ctx->SetStackFrame (frame);
- cursor_sp->reg_ctx = temp_rcs;
+ cursor_sp->reg_ctx = register_ctx_sp;
m_frames.push_back (cursor_sp);
}
}
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Thu Nov 4 04:40:56 2010
@@ -56,6 +56,7 @@
lldb::RegisterContextSP reg_ctx; // These are all RegisterContextLLDB's
Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { }
+ DISALLOW_COPY_AND_ASSIGN (Cursor);
};
typedef lldb::SharedPtr<Cursor>::Type CursorSP;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Nov 4 04:40:56 2010
@@ -26,6 +26,8 @@
#include "Utility/StringExtractorGDBRemote.h"
#include "UnwindLibUnwind.h"
#include "UnwindMacOSXFrameBackchain.h"
+#include "UnwindLLDB.h"
+#include "RegisterContextLLDB.h"
using namespace lldb;
using namespace lldb_private;
@@ -128,7 +130,7 @@
const ArchSpec target_arch (GetProcess().GetTarget().GetArchitecture ());
if (target_arch == ArchSpec("x86_64") || target_arch == ArchSpec("i386"))
{
- m_unwinder_ap.reset (new UnwindLibUnwind (*this, GetGDBProcess().GetLibUnwindAddressSpace()));
+ m_unwinder_ap.reset (new UnwindLLDB (*this));
}
else
{
Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Thu Nov 4 04:40:56 2010
@@ -35,7 +35,8 @@
m_cfi_data_initialized (false),
m_fde_index (),
m_fde_index_initialized (false),
- m_is_eh_frame (is_eh_frame)
+ m_is_eh_frame (is_eh_frame),
+ m_flags ()
{
}
Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=118240&r1=118239&r2=118240&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original)
+++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Thu Nov 4 04:40:56 2010
@@ -105,7 +105,6 @@
Address current_pc;
Target *target = thread.CalculateTarget();
- ArchSpec arch;
if (target)
{
ArchSpec arch = target->GetArchitecture ();
More information about the lldb-commits
mailing list