[PATCH] D137873: [LLDB][Minidump] Use plugin.object-file.pe-coff.abi as minidump process abi when OS is Windows.

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 14:43:03 PST 2022


zequanwu updated this revision to Diff 477008.
zequanwu edited the summary of this revision.
zequanwu added a comment.

Merge executable module's architecture into target's architecture.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137873/new/

https://reviews.llvm.org/D137873

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/test/Shell/Minidump/Windows/find-module.test
  lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml


Index: lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
===================================================================
--- lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
+++ lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
@@ -50,7 +50,7 @@
 ...
 
 --- !COFF
-OptionalHeader:  
+OptionalHeader:
   AddressOfEntryPoint: 0
   ImageBase:       720896
   SectionAlignment: 4096
@@ -67,13 +67,13 @@
   SizeOfStackCommit: 4096
   SizeOfHeapReserve: 1048576
   SizeOfHeapCommit: 4096
-  Debug:           
+  Debug:
     RelativeVirtualAddress: 8192
     Size:            28
-header:          
-  Machine:         IMAGE_FILE_MACHINE_AMD64
+header:
+  Machine:         IMAGE_FILE_MACHINE_I386
   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
-sections:        
+sections:
   - Name:            .text
     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
     VirtualAddress:  4096
Index: lldb/test/Shell/Minidump/Windows/find-module.test
===================================================================
--- lldb/test/Shell/Minidump/Windows/find-module.test
+++ lldb/test/Shell/Minidump/Windows/find-module.test
@@ -4,7 +4,25 @@
 RUN: yaml2obj %S/Inputs/find-module.exe.yaml -o %T/find-module.exe
 RUN: yaml2obj %S/Inputs/find-module.dmp.yaml -o %T/find-module.dmp
 RUN: %lldb -O "settings set target.exec-search-paths %T" \
-RUN:   -c %T/find-module.dmp -o "image dump objfile" -o exit | FileCheck %s
+RUN:   -c %T/find-module.dmp -o "image dump objfile" -o "target list" -o exit \
+RUN:   | FileCheck --check-prefix=DEFAULT %s
 
-CHECK-LABEL: image dump objfile
-CHECK: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi msvc" \
+RUN:   -O "settings set target.exec-search-paths %T" -c %T/find-module.dmp \
+RUN:   -o "target list" -o exit | FileCheck --check-prefix=MSVC %s
+
+RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi gnu" \
+RUN:   -O "settings set target.exec-search-paths %T" -c %T/find-module.dmp \
+RUN:   -o "target list" -o exit | FileCheck --check-prefix=GNU %s
+
+DEFAULT-LABEL: image dump objfile
+DEFAULT: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+
+DEFAULT-LABEL: target list
+DEFAULT: arch=i386-pc-windows-{{msvc|gnu}}
+
+MSVC-LABEL: target list
+MSVC: arch=i386-pc-windows-msvc
+
+GNU-LABEL: target list
+GNU: arch=i386-pc-windows-gnu
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===================================================================
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -290,7 +290,8 @@
   SetUnixSignals(UnixSignals::Create(GetArchitecture()));
 
   ReadModuleList();
-
+  if (ModuleSP module = GetTarget().GetExecutableModule())
+    GetTarget().MergeArchitecture(module->GetArchitecture());
   llvm::Optional<lldb::pid_t> pid = m_minidump_parser->GetPid();
   if (!pid) {
     Debugger::ReportWarning("unable to retrieve process ID from minidump file, "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137873.477008.patch
Type: text/x-patch
Size: 3175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221121/abc513a0/attachment.bin>


More information about the llvm-commits mailing list