[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-17 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 476221.
zequanwu added a comment.

Use plugin.object-file.pe-coff.abi as minidump process abi.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/test/Shell/Minidump/Windows/find-module.test

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
@@ -8,6 +8,7 @@
 
 #include "ProcessMinidump.h"
 
+#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
 #include "ThreadMinidump.h"
 
 #include "lldb/Core/DumpDataExtractor.h"
@@ -31,6 +32,7 @@
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/State.h"
 #include "llvm/BinaryFormat/Magic.h"
+#include "llvm/Support/Host.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Threading.h"
 
@@ -389,7 +391,23 @@
 
 ArchSpec ProcessMinidump::GetArchitecture() {
   if (!m_is_wow64) {
-return m_minidump_parser->GetArchitecture();
+ArchSpec arch = m_minidump_parser->GetArchitecture();
+if (arch.GetTriple().getOS() == llvm::Triple::OSType::Win32) {
+  static llvm::Triple::EnvironmentType default_env = [] {
+auto def_target = llvm::Triple(
+llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple()));
+if (def_target.getOS() == llvm::Triple::Win32 &&
+def_target.getEnvironment() != llvm::Triple::UnknownEnvironment)
+  return def_target.getEnvironment();
+return llvm::Triple::MSVC;
+  }();
+  llvm::Triple::EnvironmentType env =
+  ObjectFilePECOFF::GetGlobalPluginEnvironment();
+  if (env == llvm::Triple::UnknownEnvironment)
+env = default_env;
+  arch.GetTriple().setEnvironment(env);
+}
+return arch;
   }
 
   llvm::Triple triple;
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -88,6 +88,8 @@
 
   static lldb::SymbolType MapSymbolType(uint16_t coff_symbol_type);
 
+  static llvm::Triple::EnvironmentType GetGlobalPluginEnvironment();
+
   // LLVM RTTI support
   static char ID;
   bool isA(const void *ClassID) const override {
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -389,6 +389,10 @@
   return lldb::eSymbolTypeInvalid;
 }
 
+llvm::Triple::EnvironmentType ObjectFilePECOFF::GetGlobalPluginEnvironment() {
+  return GetGlobalPluginProperties().ABI();
+}
+
 bool ObjectFilePECOFF::CreateBinary() {
   if (m_binary)
 return true;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D137873#3933171 , @alvinhochun 
wrote:

> I think the module spec of the modules should reflect the value of the 
> `plugin.object-file.pe-coff.abi` setting. Can ProcessMinidump take the module 
> spec of the executable module to use its target environment?

That's kinda what `Target::MergeArchitecture` is for.

> Mixing MSVC and MinGW DLLs is a tricky case so I will not be surprised if 
> something doesn't work correctly. It would be nice to have it working but 
> that would be outside the scope of this review. (I don't yet have a use case 
> for this but I am getting close with some COM / WinRT experiments.)

Sounds fun. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-17 Thread Alvin Wong via Phabricator via lldb-commits
alvinhochun added a comment.

I think the module spec of the modules should reflect the value of the 
`plugin.object-file.pe-coff.abi` setting. Can ProcessMinidump take the module 
spec of the executable module to use its target environment?

Mixing MSVC and MinGW DLLs is a tricky case so I will not be surprised if 
something doesn't work correctly. It would be nice to have it working but that 
would be outside the scope of this review. (I don't yet have a use case for 
this but I am getting close with some COM / WinRT experiments.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-16 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

In D137873#3931888 , @mstorsjo wrote:

> In D137873#3930683 , @labath wrote:
>
>> If that doesn't work then (besides knowing why), I'd like us try some kind 
>> of a single-setting solution, as I don't think it makes sense to have two 
>> different settings like this (happy to hear counterarguments to that)
>
> Overall, the ideal is if the user usually needs to twiddle one single 
> setting. For a majority of cases, picking the default format (like is done 
> for the objectfile setting, and afaik this one does too even though I didn't 
> quite clearly see the codepath for it) will be what you'd want: If you're 
> working with mingw tools, debugging with a mingw built lldb, then your app 
> that you're debugging also probably uses mingw ABIs. But it's clearly not 
> implausible to want to debug executables from the other ecosystem, so being 
> able to change it with a single setting is good too.
>
> And for the objectfile setting, it's possible to set it even on a per-DLL 
> basis. This may sound contrieved, but it's actually totally reasonable. While 
> the C++ ABIs are incompatible, such DLLs can interoperate over C APIs - this 
> is not an uncommon scenario. Plus, every mingw executable links against 
> msvcrt.dll or ucrtbase.dll (provided by the system) which use the MSVC C++ 
> ABIs internally (if you use the versions of them with debug info).
>
> So the ability to set it per DLL for the objectfile part is totally 
> warranted. How that fits in towards minidump reading, I don't really know 
> though (since the whole minidump contains stuff for the whole process). In 
> which cases does the C++ ABI form matter for the minidump btw - since the 
> actual interpretation of things still would be based on per-DLL debug info 
> (either as DWARF or PDB)?

lldb creates AST for user input expression which uses the abi from minidump 
process. That AST's class layout info is imported from another AST created from 
debug info that uses the abi specified in debug info. The current situation is 
that minidump process uses itanium ABI (because it's not specified in minidump, 
falls back to use itanium), but the debug info uses msvc ABI. The inconsistent 
causes crash when lowering class.

It looks like it's impossible to make it works with DLLs that have different 
ABIs, no matter which ABI we set for minidump. Unless we change how clang 
interacts with external layout: 
https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/RecordLayoutBuilder.cpp#L1357.
 Maybe change it so that if using external layout failed due to mismatched ABI, 
try again with another ABI 
https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/RecordLayoutBuilder.cpp#L3302?




Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:452
 ArchSpec ProcessMinidump::GetArchitecture() {
+  // "settings set plugin.process.minidump.abi" overrides the env in minidump.
+  ArchSpec arch = m_minidump_parser->GetArchitecture();

labath wrote:
> Is "overrides" the correct word here? Are there any circumstances in which we 
> are able to determine the environment from the minidump file? Because if it 
> is, then I would expect this to be the other way around (that the environment 
> from a specific file overrides the generic catch-all setting)...
Yeah, the word is not correct. It should be "sets". 
I think minidump file just doesn't have that environment info: 
https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/BinaryFormat/Minidump.h#L161-L179.
 lldb sets the environment based on platform for android: 
https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp#L195.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-16 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a subscriber: alvinhochun.
mstorsjo added a comment.

In D137873#3930683 , @labath wrote:

> If that doesn't work then (besides knowing why), I'd like us try some kind of 
> a single-setting solution, as I don't think it makes sense to have two 
> different settings like this (happy to hear counterarguments to that)

Overall, the ideal is if the user usually needs to twiddle one single setting. 
For a majority of cases, picking the default format (like is done for the 
objectfile setting, and afaik this one does too even though I didn't quite 
clearly see the codepath for it) will be what you'd want: If you're working 
with mingw tools, debugging with a mingw built lldb, then your app that you're 
debugging also probably uses mingw ABIs. But it's clearly not implausible to 
want to debug executables from the other ecosystem, so being able to change it 
with a single setting is good too.

And for the objectfile setting, it's possible to set it even on a per-DLL 
basis. This may sound contrieved, but it's actually totally reasonable. While 
the C++ ABIs are incompatible, such DLLs can interoperate over C APIs - this is 
not an uncommon scenario. Plus, every mingw executable links against msvcrt.dll 
or ucrtbase.dll (provided by the system) which use the MSVC C++ ABIs internally 
(if you use the versions of them with debug info).

So the ability to set it per DLL for the objectfile part is totally warranted. 
How that fits in towards minidump reading, I don't really know though (since 
the whole minidump contains stuff for the whole process). In which cases does 
the C++ ABI form matter for the minidump btw - since the actual interpretation 
of things still would be based on per-DLL debug info (either as DWARF or PDB)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Adding a new setting isn't exactly what I had in mind. I was actually hoping 
that it would be enough to fiddle with that setting and leave the minidump 
environment blank (because we have code 

 to fill in the missing pieces of a target ArchSpec from other sources.

If that doesn't work then (besides knowing why), I'd like us try some kind of a 
single-setting solution, as I don't think it makes sense to have two different 
settings like this (happy to hear counterarguments to that). I'd consider 
either moving that environment setting to some place more generic (so it can be 
accessed from both plugins) or just having the minidump plugin fetch the 
setting from inside ObjectFilePECOFF (I'd say that a process->object dependency 
is kinda OK, and we already have ProcessMachCore depending on ObjectFileMachO).




Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:452
 ArchSpec ProcessMinidump::GetArchitecture() {
+  // "settings set plugin.process.minidump.abi" overrides the env in minidump.
+  ArchSpec arch = m_minidump_parser->GetArchitecture();

Is "overrides" the correct word here? Are there any circumstances in which we 
are able to determine the environment from the minidump file? Because if it is, 
then I would expect this to be the other way around (that the environment from 
a specific file overrides the generic catch-all setting)...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-15 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 475628.
zequanwu added a comment.
Herald added subscribers: llvm-commits, mstorsjo.
Herald added a project: LLVM.

Add `settings set plugin.process.minidump.abi msvc/gnu` to override minidump 
abi triple.


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/CMakeLists.txt
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.h
  lldb/source/Plugins/Process/minidump/ProcessMinidumpProperties.td
  lldb/test/Shell/Minidump/Windows/find-module.test
  llvm/utils/gn/secondary/lldb/source/Plugins/Process/minidump/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Plugins/Process/minidump/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Plugins/Process/minidump/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Plugins/Process/minidump/BUILD.gn
@@ -1,7 +1,20 @@
+import("//lldb/utils/TableGen/lldb_tablegen.gni")
+
+lldb_tablegen("ProcessMinidumpProperties") {
+  args = [ "-gen-lldb-property-defs" ]
+}
+
+lldb_tablegen("ProcessMinidumpPropertiesEnum") {
+  args = [ "-gen-lldb-property-enum-defs" ]
+  td_file = "ProcessMinidumpProperties.td"
+}
+
 static_library("minidump") {
   output_name = "lldbPluginProcessMinidump"
   configs += [ "//llvm/utils/gn/build:lldb_code" ]
   deps = [
+":ProcessMinidumpProperties",
+":ProcessMinidumpPropertiesEnum",
 "//lldb/source/Core",
 "//lldb/source/Plugins/Process/Utility",
 "//lldb/source/Plugins/Process/elf-core",
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,21 @@
 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 -DABI=msvc -DFILENAME=%basename_t.tmp %s
+
+RUN: %lldb -O "settings set plugin.process.minidump.abi msvc" \
+RUN:   -O "settings set target.exec-search-paths %T" \
+RUN:   -c %T/find-module.dmp -o "image dump objfile" -o "target list" -o exit \
+RUN:   | FileCheck -DABI=msvc -DFILENAME=%basename_t.tmp %s
+
+RUN: %lldb -O "settings set plugin.process.minidump.abi gnu" \
+RUN:   -O "settings set target.exec-search-paths %T" \
+RUN:   -c %T/find-module.dmp -o "image dump objfile" -o "target list" -o exit \
+RUN:   | FileCheck -DABI=gnu -DFILENAME=%basename_t.tmp %s
 
 CHECK-LABEL: image dump objfile
 CHECK: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+
+CHECK-LABEL: target list
+CHECK: arch=i386-pc-windows-[[ABI]]
Index: lldb/source/Plugins/Process/minidump/ProcessMinidumpProperties.td
===
--- /dev/null
+++ lldb/source/Plugins/Process/minidump/ProcessMinidumpProperties.td
@@ -0,0 +1,9 @@
+include "../../../../include/lldb/Core/PropertiesBase.td"
+
+let Definition = "processminidump" in {
+  def ABI: Property<"abi", "Enum">,
+Global,
+DefaultEnumValue<"llvm::Triple::UnknownEnvironment">,
+EnumValues<"OptionEnumValues(g_abi_enums)">,
+Desc<"ABI to use when loading a Windows minidump. This configures the C++ ABI used, which affects things like the handling of class layout. Accepted values are: `msvc` for the MSVC ABI, `gnu` for the MinGW / Itanium ABI, and `default` to follow the default target if it is a Windows triple or use the MSVC ABI by default.">;
+}
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.h
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.h
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.h
@@ -35,6 +35,8 @@
 
   static void Initialize();
 
+  static void DebuggerInitialize(Debugger );
+
   static void Terminate();
 
   static llvm::StringRef GetPluginNameStatic() { return "minidump"; }
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupBoolean.h"
+#include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Target/JITLoaderList.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Target/SectionLoadList.h"
@@ -46,6 +47,55 @@
 
 namespace {
 
+static constexpr 

[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-15 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu reclaimed this revision.
zequanwu added a comment.

Oh, they are not the same. I will work on a similar setting for minidump.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-15 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu abandoned this revision.
zequanwu added a comment.

In D137873#3926821 , @labath wrote:

> This dual environment thing is tricky.. MSVC is probably a better default, 
> but it would still mean that the same bugs will appear if the situation is 
> reversed (we assume MSVC environ, but the binary actually uses GNU). Have you 
> looked at how this interacts with https://reviews.llvm.org/D127048 (and the 
> setting introduced there) and whether you can achieve the same effect by 
> changing that setting?

Thanks, I didn't realize the existence of this setting.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-15 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This dual environment thing is tricky.. MSVC is probably a better default, but 
it would still mean that the same bugs will appear if the situation is reversed 
(we assume MSVC environ, but the binary actually uses GNU). Have you looked at 
how this interacts with https://reviews.llvm.org/D127048 (and the setting 
introduced there) and whether you can achieve the same effect by changing that 
setting?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Set abi environment for windows.

2022-11-11 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu created this revision.
zequanwu added a reviewer: labath.
Herald added a project: All.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

If we don't set it, clang will use itanium abi to create record layout which may
cause crash.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137873

Files:
  lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
  lldb/test/Shell/Minidump/Windows/find-module.test


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,11 @@
 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 %s
 
 CHECK-LABEL: image dump objfile
 CHECK: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+
+CHECK-LABEL: target list
+CHECK: arch=i386-pc-windows-msvc
Index: lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -178,6 +178,7 @@
   case OSPlatform::Win32CE:
 triple.setOS(llvm::Triple::OSType::Win32);
 triple.setVendor(llvm::Triple::VendorType::PC);
+triple.setEnvironment(llvm::Triple::EnvironmentType::MSVC);
 break;
   case OSPlatform::Linux:
 triple.setOS(llvm::Triple::OSType::Linux);


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,11 @@
 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 %s
 
 CHECK-LABEL: image dump objfile
 CHECK: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+
+CHECK-LABEL: target list
+CHECK: arch=i386-pc-windows-msvc
Index: lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -178,6 +178,7 @@
   case OSPlatform::Win32CE:
 triple.setOS(llvm::Triple::OSType::Win32);
 triple.setVendor(llvm::Triple::VendorType::PC);
+triple.setEnvironment(llvm::Triple::EnvironmentType::MSVC);
 break;
   case OSPlatform::Linux:
 triple.setOS(llvm::Triple::OSType::Linux);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits