Get a disassembler based on the correct architecture for assembly
prologue profiling.
Change the log print statements to elide the thread number, make
some of them only print when IsLogVerbose().
Add a couple of sanity checks for impossible CFA values so backtraces
don't go too far off into the weeds.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117343 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
index 0e2a4a7..58b2ee0 100644
--- a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
+++ b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
@@ -480,14 +480,14 @@
const char *triple;
// FIXME should probably pass down the ArchSpec and work from that to make a portable triple
if (m_cpu == k_i386)
- triple = "i386-apple-darwin";
+ triple = "i386-unknown-unknown";
else
- triple = "x86_64-apple-darwin";
+ triple = "x86_64-unknown-unknown";
EDDisassemblerRef disasm;
EDInstRef cur_insn;
- if (EDGetDisassembler (&disasm, "i386-apple-darwin", kEDAssemblySyntaxX86ATT) != 0)
+ if (EDGetDisassembler (&disasm, triple, kEDAssemblySyntaxX86ATT) != 0)
{
return false;
}
@@ -565,7 +565,15 @@
unwind_plan.AppendRow (row);
goto loopnext;
}
-
+
+ if (mov_rsp_rbp_pattern_p ())
+ {
+ row.SetOffset (current_func_text_offset + insn_len);
+ row.SetCFARegister (m_lldb_fp_regnum);
+ unwind_plan.AppendRow (row);
+ goto loopnext;
+ }
+
// This is the start() function (or a pthread equivalent), it starts with a pushl $0x0 which puts the
// saved pc value of 0 on the stack. In this case we want to pretend we didn't see a stack movement at all --
// normally the saved pc value is already on the stack by the time the function starts executing.
@@ -617,14 +625,6 @@
goto loopnext;
}
- if (mov_rsp_rbp_pattern_p ())
- {
- row.SetOffset (current_func_text_offset + insn_len);
- row.SetCFARegister (m_lldb_fp_regnum);
- unwind_plan.AppendRow (row);
- goto loopnext;
- }
-
if (ret_pattern_p ())
{
// we know where the end of the function is; set the limit on the PlanValidAddressRange