Author: labath
Date: Wed Sep  4 06:26:41 2019
New Revision: 370898

URL: http://llvm.org/viewvc/llvm-project?rev=370898&view=rev
Log:
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.

Added:
    lldb/trunk/lit/Minidump/disassemble-no-module.yaml
    lldb/trunk/lit/Minidump/lit.local.cfg
Modified:
    lldb/trunk/source/Commands/CommandObjectDisassemble.cpp

Added: lldb/trunk/lit/Minidump/disassemble-no-module.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/disassemble-no-module.yaml?rev=370898&view=auto
==============================================================================
--- lldb/trunk/lit/Minidump/disassemble-no-module.yaml (added)
+++ lldb/trunk/lit/Minidump/disassemble-no-module.yaml Wed Sep  4 06:26:41 2019
@@ -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
+
+...

Added: lldb/trunk/lit/Minidump/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/lit.local.cfg?rev=370898&view=auto
==============================================================================
--- lldb/trunk/lit/Minidump/lit.local.cfg (added)
+++ lldb/trunk/lit/Minidump/lit.local.cfg Wed Sep  4 06:26:41 2019
@@ -0,0 +1 @@
+config.suffixes = ['.test', '.yaml']

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=370898&r1=370897&r2=370898&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Wed Sep  4 06:26:41 
2019
@@ -510,7 +510,7 @@ bool CommandObjectDisassemble::DoExecute
         } 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)


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to