From 052297524624db02eff91252c582037dc99c0528 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 4 Sep 2019 13:26:41 +0000 Subject: [PATCH] disassemble command: fix error message when disassembly fails We were printing the start_addr field, which is not correct, as in this branch we are processing the memory described by cur_range. Print that instead. Ideally, in particular this case, the error message would also say something about not being able to disassemble due to not having found the module from the core file, but that is not easy to do right now, so I'm leaving that for another time. llvm-svn: 370898 --- lldb/lit/Minidump/disassemble-no-module.yaml | 48 +++++++++++++++++++ lldb/lit/Minidump/lit.local.cfg | 1 + .../Commands/CommandObjectDisassemble.cpp | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 lldb/lit/Minidump/disassemble-no-module.yaml create mode 100644 lldb/lit/Minidump/lit.local.cfg diff --git a/lldb/lit/Minidump/disassemble-no-module.yaml b/lldb/lit/Minidump/disassemble-no-module.yaml new file mode 100644 index 000000000000..14637d5b7c63 --- /dev/null +++ b/lldb/lit/Minidump/disassemble-no-module.yaml @@ -0,0 +1,48 @@ +# RUN: yaml2obj %s > %t +# RUN: %lldb -c %t -o bt -o disassemble 2>&1 | FileCheck %s + +# CHECK-LABEL: (lldb) bt +# CHECK: frame #0: 0x0000000000400430 +# CHECK-LABEL: (lldb) disassemble +# CHECK-NEXT: error: error reading data from section .module_image +# CHECK-NEXT: error: Failed to disassemble memory at 0x00400430. + +--- !minidump +Streams: + - Type: ThreadList + Threads: + - Thread Id: 0x000074F3 + Context: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B001000000000006CAE000000006B7FC05A0000C81D415A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A2BF9E5A6B7F0000000000000000000000000000000000008850C14BFD7F00009850C14BFD7F00000100000000000000B04AC14BFD7F0000000000000000000060812D01000000000800000000000000B065E05A6B7F00008004400000000000E050C14BFD7F00000000000000000000000000000000000030044000000000007F03FFFF0000FFFFFFFFFFFF000000000000000000000000801F00006B7F00000400000000000000B84CC14BFD7F0000304D405A6B7F0000C84DC14BFD7F0000C0AA405A6B7F00004F033D0000000000B84DC14BFD7F0000E84DC14BFD7F0000000000000000000000000000000000000070E05A6B7F000078629E5A6B7F0000C81D415A6B7F0000804F9E5A6B7F00000000000001000000E603000001000000E093115A6B7F0000804EC14BFD7F0000584EC14BFD7F000099ADC05A6B7F00000100000000000000AAAAD77D0000000002000000000000000800000000000000B065E05A6B7F0000E6B7C05A6B7F0000010000006B7F0000884DC14BFD7F0000106F7C5A6B7F0000984EC14BFD7F0000488B7C5A6B7F0000C4A71CB90000000001000000000000000800000000000000B065E05A6B7F000048B6C05A6B7F0000702AE25A6B7F0000D84DC14BFD7F000030489E5A6B7F0000E84EC14BFD7F0000E05E9E5A6B7F00000991F0460000000001000000000000000800000000000000B065E05A6B7F000048B6C05A6B7F00000100000000000000284EC14BFD7F00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + Stack: + Start of Memory Range: 0x00007FFD4BC15080 + Content: 30044000000000000000000000000000 + - Type: ModuleList + Modules: + - Base of Image: 0x0000000000400000 + Size of Image: 0x00001000 + Module Name: 'nonexisting-module' + CodeView Record: 4C4570426CCF3F60FFA7CC4B86AE8FF44DB2576A68983611 + - Type: MemoryList + Memory Ranges: + - Start of Memory Range: 0x00007FFD4BC15080 + Content: 30044000000000000000000000000000 + - Type: SystemInfo + Processor Arch: AMD64 + Platform ID: Linux + CPU: + Vendor ID: GenuineIntel + Version Info: 0x00000000 + Feature Info: 0x00000000 + - Type: LinuxProcStatus + Text: | + Name: nonexisting-module + State: t (tracing stop) + Tgid: 29939 + Ngid: 0 + Pid: 29939 + PPid: 29370 + TracerPid: 29940 + Uid: 1001 1001 1001 1001 + Gid: 1001 1001 1001 1001 + +... diff --git a/lldb/lit/Minidump/lit.local.cfg b/lldb/lit/Minidump/lit.local.cfg new file mode 100644 index 000000000000..db82cc231003 --- /dev/null +++ b/lldb/lit/Minidump/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test', '.yaml'] diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index 7c5859126bfd..69e2d757b5fe 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -510,7 +510,7 @@ bool CommandObjectDisassemble::DoExecute(Args &command, } else { result.AppendErrorWithFormat( "Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", - m_options.start_addr); + cur_range.GetBaseAddress().GetLoadAddress(target)); result.SetStatus(eReturnStatusFailed); } if (print_sc_header)