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.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@118240 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index e0fc02c..f112a95 100644
--- a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -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!");
     }
 }
diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 5b7ea72..28ef513 100644
--- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -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;
diff --git a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
index e0f99d9..8521231 100644
--- a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
+++ b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
@@ -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);
 
diff --git a/source/Plugins/Process/Utility/UnwindLLDB.cpp b/source/Plugins/Process/Utility/UnwindLLDB.cpp
index 9fdd05d..8fb7763 100644
--- a/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ b/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -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);
         }
     }
diff --git a/source/Plugins/Process/Utility/UnwindLLDB.h b/source/Plugins/Process/Utility/UnwindLLDB.h
index f281269..128a4a7 100644
--- a/source/Plugins/Process/Utility/UnwindLLDB.h
+++ b/source/Plugins/Process/Utility/UnwindLLDB.h
@@ -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;
diff --git a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index d666734..7e06e78 100644
--- a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -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
         {