Update UnwindPlan dump to list if it is a trap handler func; also Command

Update the "image show-unwind" command output to show if the function
being shown is listed as a user-setting or platform trap handler.

Update the individual UnwindPlan dumps to show whether the unwind plan
is registered as a trap handler.
This commit is contained in:
Jason Molenda 2020-08-25 20:53:01 -07:00
parent 72bdb41a06
commit 99d187a003
8 changed files with 45 additions and 1 deletions

View File

@ -3421,10 +3421,35 @@ protected:
continue;
result.GetOutputStream().Printf(
"UNWIND PLANS for %s`%s (start addr 0x%" PRIx64 ")\n\n",
"UNWIND PLANS for %s`%s (start addr 0x%" PRIx64 ")\n",
sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(),
funcname.AsCString(), start_addr);
Args args;
target->GetUserSpecifiedTrapHandlerNames(args);
size_t count = args.GetArgumentCount();
for (size_t i = 0; i < count; i++) {
const char *trap_func_name = args.GetArgumentAtIndex(i);
if (strcmp(funcname.GetCString(), trap_func_name) == 0)
result.GetOutputStream().Printf(
"This function is "
"treated as a trap handler function via user setting.\n");
}
PlatformSP platform_sp(target->GetPlatform());
if (platform_sp) {
const std::vector<ConstString> trap_handler_names(
platform_sp->GetTrapHandlerSymbolNames());
for (ConstString trap_name : trap_handler_names) {
if (trap_name == funcname) {
result.GetOutputStream().Printf(
"This function's "
"name is listed by the platform as a trap handler.\n");
}
}
}
result.GetOutputStream().Printf("\n");
UnwindPlanSP non_callsite_unwind_plan =
func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread);
if (non_callsite_unwind_plan) {

View File

@ -527,6 +527,18 @@ void UnwindPlan::Dump(Stream &s, Thread *thread, lldb::addr_t base_addr) const {
s.Printf("not specified.\n");
break;
}
s.Printf("This UnwindPlan is for a trap handler function: ");
switch (m_plan_is_for_signal_trap) {
case eLazyBoolYes:
s.Printf("yes.\n");
break;
case eLazyBoolNo:
s.Printf("no.\n");
break;
case eLazyBoolCalculate:
s.Printf("not specified.\n");
break;
}
if (m_plan_valid_address_range.GetBaseAddress().IsValid() &&
m_plan_valid_address_range.GetByteSize() > 0) {
s.PutCString("Address range of this UnwindPlan: ");

View File

@ -12,6 +12,7 @@ CHECK: Assembly language inspection UnwindPlan:
CHECK-NEXT: This UnwindPlan originally sourced from EmulateInstructionARM
CHECK-NEXT: This UnwindPlan is sourced from the compiler: no.
CHECK-NEXT: This UnwindPlan is valid at all instruction locations: yes.
CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
CHECK-NEXT: row[0]: 0: CFA=sp +0 =>
CHECK-NEXT: row[1]: 4: CFA=sp +8 => fp=[CFA-8] lr=[CFA-4]
CHECK-NEXT: row[2]: 6: CFA=fp +8 => fp=[CFA-8] lr=[CFA-4]

View File

@ -10,6 +10,7 @@ image show-unwind -n func0
# CHECK-NEXT: This UnwindPlan originally sourced from breakpad STACK CFI
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
# CHECK-NEXT: Address range of this UnwindPlan: [stack-cfi-parsing.out..module_image + 0-0x0000000000000002)
# CHECK-NEXT: row[0]: 0: CFA=DW_OP_breg7 +0 => rbp=DW_OP_breg7 +0 rip=DW_OP_pick 0x0
# CHECK-NEXT: row[1]: 1: CFA=DW_OP_breg7 +0 => rbx=DW_OP_breg2 +0 rbp=DW_OP_breg0 +0 rip=DW_OP_pick 0x0

View File

@ -12,6 +12,7 @@ image show-unwind -n call_many
# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
# CHECK: This UnwindPlan is sourced from the compiler: yes.
# CHECK: This UnwindPlan is valid at all instruction locations: no.
# CHECK: This UnwindPlan is for a trap handler function: no.
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
# CHECK: row[0]: 0: CFA=RaSearch@SP+0 => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref

View File

@ -12,6 +12,7 @@ image show-unwind -n bar
# CHECK-NEXT: This UnwindPlan originally sourced from breakpad STACK CFI
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is valid at all instruction locations: no.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.
# CHECK-NEXT: Address range of this UnwindPlan: [unwind-via-stack-cfi..module_image + 1056-0x0000000000000449)
# CHECK-NEXT: row[0]: 0: CFA=DW_OP_breg6 +0, DW_OP_deref => rbp=DW_OP_pick 0x0, DW_OP_deref rsp=DW_OP_pick 0x0, DW_OP_consts +16, DW_OP_plus rip=DW_OP_pick 0x0, DW_OP_consts +8, DW_OP_plus, DW_OP_deref

View File

@ -14,6 +14,7 @@ image show-unwind -n call_many
# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
# CHECK: This UnwindPlan is sourced from the compiler: yes.
# CHECK: This UnwindPlan is valid at all instruction locations: no.
# CHECK: This UnwindPlan is for a trap handler function: no.
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4112-0x0000107d)
# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0, DW_OP_consts +80, DW_OP_plus => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref
@ -42,6 +43,7 @@ image show-unwind -n temporary_var
# CHECK: This UnwindPlan originally sourced from breakpad STACK WIN
# CHECK: This UnwindPlan is sourced from the compiler: yes.
# CHECK: This UnwindPlan is valid at all instruction locations: no.
# CHECK: This UnwindPlan is for a trap handler function: no.
# CHECK: Address range of this UnwindPlan: [unwind-via-stack-win.exe..module_image + 4400-0x00001134)
# CHECK: row[0]: 0: CFA=DW_OP_breg7 +0 => esp=DW_OP_pick 0x0, DW_OP_consts +4, DW_OP_plus eip=DW_OP_pick 0x0, DW_OP_deref

View File

@ -24,3 +24,4 @@ image show-unwind -n main
# CHECK: debug_frame UnwindPlan:
# CHECK-NEXT: This UnwindPlan originally sourced from DWARF CFI
# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
# CHECK-NEXT: This UnwindPlan is for a trap handler function: no.