[all-commits] [llvm/llvm-project] 8a64dd: [lldb] Fix reading i686-windows executables with G...

alvinhochun via All-commits all-commits at lists.llvm.org
Wed Jun 22 07:17:14 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a64dd5b06146f073a4a326f0e24fa18e571b281
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M lldb/source/Utility/ArchSpec.cpp
    A lldb/test/Shell/ObjectFile/PECOFF/settings-abi-i686.yaml

  Log Message:
  [lldb] Fix reading i686-windows executables with GNU environment

25c8a061c5739677d2fc0af29a8cc9520207b923 / D127048 added an option
for setting the ABI to GNU.

When an object file is loaded, there's only minimal verification
done for the architecture spec set for it, if the object file only
provides one.

However, for i386 object files, the PECOFF object file plugin
provides two architectures, i386-pc-windows and i686-pc-windows.
This picks a totally different codepath in
TargetList::CreateTargetInternal, where it's treated as a fat
binary. This goes through more verifications to see if the
architectures provided by the object file matches what the
platform plugin supports.

The PlatformWindows() constructor explicitly adds the
"i386-pc-windows" and "i686-pc-windows" architectures (even when
running on other architectures), which allows this "fat binary
verification" to succeed for the i386 object files that provide
two architectures.

However, after that commit, if the object file is advertised with
the different environment (either when lldb is built in a mingw
environment, or if that setting is set), the fat binary validation
won't accept the file any longer.

Update ArchSpec::IsEqualTo with more logic for the Windows use
cases; mismatching vendors is not an issue (they don't have any
practical effect on Windows), and GNU and MSVC environments are
compatible to the point that PlatformWindows can handle object
files for both environments/ABIs.

As a separate path forward, one could also consider to stop returning
two architecture specs from ObjectFilePECOFF::GetModuleSpecifications
for i386 files.

Differential Revision: https://reviews.llvm.org/D128268

  Commit: 2bae9560575362ffd756f193efa1de2d5c2f4cfd
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Target/TargetList.cpp
    A lldb/test/Shell/Commands/command-target-create-resolve-exe.test

  Log Message:
  [lldb] Resolve exe location for `target create`

This fixes an issue that, when you start lldb or use `target create`
with a program name which is on $PATH, or not specify the .exe suffix of
a program in the working directory on Windows, you get a confusing
error, for example:

    (lldb) target create notepad
    error: 'C:\WINDOWS\SYSTEM32\notepad.exe' doesn't contain any 'host'
    platform architectures: i686, x86_64, i386, i386

Fixes https://github.com/mstorsjo/llvm-mingw/issues/265

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D127436

  Commit: 4d123783957e547009e55346bf3a8ae43a88fa14
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h

  Log Message:
  [lldb][windows] Fix crash on getting nested exception

LLDB tries to follow `EXCEPTION_RECORD::ExceptionRecord` to follow the
nested exception chain. In practice this code just causes Access
Violation whenever there is a nested exception. Since there does not
appear to be any code in LLDB that is actually using the nested
exceptions, this change just removes the crashing code and adds a
comment for future reference.

Fixes https://github.com/mstorsjo/llvm-mingw/issues/292

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D128201

  Commit: 3c867898c7be7ed2b5d119a2478a836a0c85f19b
  Author: Alvin Wong <alvin at alvinhc.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M lldb/include/lldb/Interpreter/OptionValueDictionary.h
    M lldb/source/Interpreter/OptionValueDictionary.cpp
    M lldb/source/Interpreter/Property.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    M lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFFProperties.td
    M lldb/test/Shell/ObjectFile/PECOFF/settings-abi.yaml

  Log Message:
  [lldb] Add setting to override PE/COFF ABI by module name

The setting `plugin.object-file.pe-coff.module-abi` is a string-to-enum
map that allows specifying an ABI to a module name. For example:


This allows for debugging a process which mixes both modules built using
the MSVC ABI and modules built using the MinGW ABI.

Depends on D127048

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D127234

Compare: https://github.com/llvm/llvm-project/compare/17e27025287b...3c867898c7be

More information about the All-commits mailing list