492 Commits

Author SHA1 Message Date
Dhruv Srivastava
b804516dc5
[lldb][AIX] 1. Avoid namespace collision on other platforms (#104679)
This PR is in reference to porting LLDB on AIX.

Link to discussions on llvm discourse and github:
1.  https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640
2.  #101657 

The complete changes for porting are present in this draft PR:
https://github.com/llvm/llvm-project/pull/102601

The changes on this PR are intended to avoid namespace collision for
certain typedefs between lldb and other platforms:
1. tid_t --> lldb::tid_t
2. offset_t --> lldb::offset_t
2024-08-20 10:19:32 +01:00
Jacob Lalonde
572943e790
[LLDB] Reapply #100443 SBSaveCore Thread list (#104497)
Reapply #100443 and #101770. These were originally reverted due to a
test failure and an MSAN failure. I changed the test attribute to
restrict to x86 (following the other existing tests). I could not
reproduce the test or the MSAN failure and no repo steps were provided.
2024-08-15 16:29:59 -07:00
Jacob Lalonde
accf5c9bb3
Revert "[LLDB][SBSaveCore] Implement a selectable threadlist for Core… (#102018)
… Options.  (#100443)"

This reverts commit 3e4af616334eae532f308605b89ff158dd195180.

@adrian-prantl FYI

Reverts #100443
2024-08-05 10:17:25 -07:00
Haojian Wu
86f7374078 Revert "[LLDB][SBSaveCore] Fix bug where default values are not propagated. (#101770)"
This reverts commit 34766d0d488ba2fbefa80dcd0cc8720a0e753448 which
caused a msan failure, see comment https://github.com/llvm/llvm-project/pull/101770#issuecomment-2268373325 for details.
2024-08-05 09:37:36 +02:00
Jacob Lalonde
34766d0d48
[LLDB][SBSaveCore] Fix bug where default values are not propagated. (#101770)
In #100443, Mach-o and Minidump now only call process API's that take a
`SaveCoreOption` as the container for the style and information if a
thread should be included in the core or not. This introduced a bug
where in subsequent method calls we were not honoring the defaults of
both implementations.

~~To solve this I have made a copy of each SaveCoreOptions that is
mutable by the respective plugin. Originally I wanted to leave the
SaveCoreOptions as non const so these default value mutations could be
shown back to the user. Changing that behavior is outside of the scope
of this bugfix, but is context for why we are making a copy.~~

Removed const on the savecoreoptions so defaults can be inspected by the
user

CC: @Michael137
2024-08-02 18:38:05 -07:00
Jacob Lalonde
3e4af61633
[LLDB][SBSaveCore] Implement a selectable threadlist for Core Options. (#100443)
In #98403 I enabled the SBSaveCoreOptions object, which allows users via
the scripting API to define what they want saved into their core file.
As the first option I've added a threadlist, so users can scan and
identify which threads and corresponding stacks they want to save.

In order to support this, I had to add a new method to `Process.h` on
how we identify which threads are to be saved, and I had to change the
book keeping in minidump to ensure we don't double save the stacks.

Important to @jasonmolenda I also changed the MachO coredump to accept
these new APIs.
2024-08-02 13:35:05 -07:00
Jonas Devlieghere
e846fb4803
[lldb] Prevent passing a nullptr to std::string in ObjectFileMachO (#100421)
Prevent passing a nullptr to std::string::insert in
ObjectFileMachO::GetDependentModules. Calling GetCString on an empty
ConstString will return a nullptr, which is undefined behavior. Instead,
use the GetString helper which will return an empty string in that case.

rdar://132388027
2024-07-24 15:07:38 -07:00
Jacob Lalonde
4120570dc4
[LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (#98403)
This PR adds `SBSaveCoreOptions`, which is a container class for options
when LLDB is taking coredumps. For this first iteration this container
just keeps parity with the extant API of `file, style, plugin`. In the
future this options object can be extended to allow users to take a
subset of their core dumps.
2024-07-18 17:10:15 -07:00
Jason Molenda
91c0ef6f67
[lldb] [ObjectFileMachO] BSS segments are loadable segments (#96983)
ObjectFileMachO::SetLoadAddress sets the address of each segment in a
binary in a Target, but it ignores segments that are not loaded in the
virtual address space. It was marking segments that were purely BSS --
having no content in the file, but in zero-initialized memory when
running in the virtual address space -- as not-loadable, unless they
were named "DATA". This works pretty well for typical userland binaries,
but in less Darwin environments, there may be BSS segments with other
names, that ARE loadable.

I looked at the origin of SectionIsLoadable's check for this, and it was
a cleanup by Greg in 2018 where we had three different implementations
of the idea in ObjectFileMachO and one of them skipped zero-file-size
segments (BSS), which made it into the centralized SectionIsLoadable
method.

Also add some logging to the DynamicLoader log channel when loading a
binary - it's the first place I look when debugging segment address
setting bugs, and it wasn't emitting anything.

rdar://129870649
2024-07-01 21:56:33 -07:00
Jason Molenda
1934208132
[lldb] NFC add comments and test case for ObjectFileMachO delay-init (#95067)
Add comments and a test for delay-init libraries on macOS. I originally
added the support in 954d00e87cdd77d0e9e367be52e62340467bd779 a month
ago, but without these additional clarifications.

rdar://126885033
2024-06-10 20:33:38 -07:00
Jason Molenda
954d00e87c [lldb] MachO delay-init binaries don't load as dependent 2024-05-02 15:20:17 -07:00
Jason Molenda
765d4c402f
[lldb] [ObjectFileMachO] LLVM_COV is not mapped into firmware memory (#86359)
It is possible to gather code coverage in a firmware environment, where
the __LLVM_COV segment will not be mapped in memory but does exist in
the binary, see

https://llvm.org/devmtg/2020-09/slides/PhippsAlan_EmbeddedCodeCoverage_LLVM_Conf_Talk_final.pdf

The __LLVM_COV segment in the binary happens to be at the same address
as the __DATA segment, so if lldb treats this segment as loaded, it
shadows the __DATA segment and address->symbol resolution can fail.

For these non-userland code cases, we need to mark __LLVM_COV as not a
loadable segment.

rdar://124475661
2024-03-25 15:00:36 -07:00
Jason Molenda
aeaa11aeac
[lldb] Address mask sbprocess apis and new mask invalid const (#83663)
[lldb] Add SBProcess methods for get/set/use address masks (#83095)

I'm reviving a patch from phabracator, https://reviews.llvm.org/D155905
which was approved but I wasn't thrilled with all the API I was adding
to SBProcess for all of the address mask types / memory regions. In this
update, I added enums to control type address mask type (code, data,
any) and address space specifiers (low, high, all) with defaulted
arguments for the most common case.  I originally landed this via
https://github.com/llvm/llvm-project/pull/83095 but it failed on CIs
outside of arm64 Darwin so I had to debug it on more environments
and update the patch.

This patch is also fixing a bug in the "addressable bits to address
mask" calculation I added in AddressableBits::SetProcessMasks. If lldb
were told that 64 bits are valid for addressing, this method would
overflow the calculation and set an invalid mask. Added tests to check
this specific bug while I was adding these APIs.

This patch changes the value of "no mask set" from 0 to
LLDB_INVALID_ADDRESS_MASK, which is UINT64_MAX. A mask of all 1's
means "no bits are used for addressing" which is an impossible mask,
whereas a mask of 0 means "all bits are used for addressing" which
is possible.

I added a base class implementation of ABI::FixCodeAddress and
ABI::FixDataAddress that will apply the Process mask values if they
are set to a value other than LLDB_INVALID_ADDRESS_MASK.

I updated all the callers/users of the Mask methods which were
handling a value of 0 to mean invalid mask to use
LLDB_INVALID_ADDRESS_MASK.

I added code to the all AArch64 ABI Fix* methods to apply the
Highmem masks if they have been set.  These will not be set on a
Linux environment, but in TestAddressMasks.py I test the highmem
masks feature for any AArch64 target, so all AArch64 ABI  plugins 
must handle it.

rdar://123530562
2024-03-06 10:06:56 -08:00
Jonas Devlieghere
1b26c25f7e
[llvm] Upstream the BridgeOS triple enum value (NFC)
This upstreams the BridgeOS target triple enum value.
2024-02-19 12:20:23 -08:00
Jonas Devlieghere
3b6a8f823b
[lldb] Upstream xros support in lldb (#78389)
Upstream support for debugging xros applications through LLDB.
2024-01-17 09:47:08 -08:00
Chelsea Cassanova
f1ef910b97
[lldb][Progress] Separate title and details (#77547)
Per this RFC:
https://discourse.llvm.org/t/rfc-improve-lldb-progress-reporting/75717
on improving progress reports, this commit separates the title field and
details field so that the title specifies the category that the progress
report falls under. The details field is added as a part of the
constructor for progress reports and by default is an empty string. In addition, changes the total amount of progress completed into a std::optional. Also
updates the test to check for details being correctly reported from the
event structured data dictionary.
2024-01-16 07:57:18 -08:00
Jason Molenda
5f71aa9270
[lldb] [Mach-O] don't strip the end of the "kern ver str" LC_NOTE (#77538)
The "kern ver str" LC_NOTE gives lldb a kernel version string -- with a
UUID and/or a load address (stext) to load it at. The LC_NOTE specifies
a size of the identifier string in bytes. In
ObjectFileMachO::GetIdentifierString, I copy that number of bytes into a
std::string, and in case there were additional nul characters at the end
of the sting for padding reasons, I tried to shrink the std::string to
not include these extra nul's.

However, I did this resizing without handling the case of an empty
identifier string. I don't know why any corefile creator would do that,
but of course at least one does. This patch removes the resizing
altogether; I was solving something that hasn't ever shown to be a
problem. I also added a test case for this, to check that lldb doesn't
crash when given one of these corefiles.

rdar://120390199
2024-01-09 15:20:06 -08:00
Kazu Hirata
ee667db4b8 [lldb] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-16 15:02:15 -08:00
Kazu Hirata
744f38913f [lldb] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-16 14:39:37 -08:00
Greg Clayton
215bacb5dc
Centralize the code that figures out which memory ranges to save into core files (#71772)
Prior to this patch, each core file plugin (ObjectFileMachO.cpp and
ObjectFileMinindump.cpp) would calculate the address ranges to save in
different ways. This patch adds a new function to Process.h/.cpp:

```
Status Process::CalculateCoreFileSaveRanges(lldb::SaveCoreStyle core_style, CoreFileMemoryRanges &ranges);
```

The patch updates the ObjectFileMachO::SaveCore(...) and
ObjectFileMinindump::SaveCore(...) to use same code. This will allow
core files to be consistent with the lldb::SaveCoreStyle across
different core file creators and will allow us to add new core file
saving features that do more complex things in future patches.
2023-11-11 11:21:32 -08:00
Alex Langford
133bcacecf
[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsDictionary (#71961)
Similar to my previous patch (#71613) where I changed
`GetItemAtIndexAsString`, this patch makes the same change to
`GetItemAtIndexAsDictionary`.

`GetItemAtIndexAsDictionary` now returns a std::optional that is either
`std::nullopt` or is a valid pointer. Therefore, if the optional is
populated, we consider the pointer to always be valid (i.e. no need to
check pointer validity).
2023-11-10 12:47:43 -08:00
Jonas Devlieghere
745e8bfd1a
[lldb] Remove LocateSymbolFile (#71301)
This completes the conversion of LocateSymbolFile into a SymbolLocator
plugin. The only remaining function is DownloadSymbolFileAsync which
doesn't really fit into the plugin model, and therefore moves into the
SymbolLocator class, while still relying on the plugins to do the
underlying work.
2023-11-05 08:26:42 -08:00
Jonas Devlieghere
d3cbf9fb64
[lldb] Add logging to ObjectFileMachO::ParseSymtab (#70490)
I have a crash when parsing the dyld trie data and I want to ask the
originator to send me the (possibly corrupted) binary that's causing
this. This patch adds some logging to help pinpoint that file.
2023-10-27 14:50:21 -07:00
Jason Molenda
2cab996192 Add "process metadata" Mach-O LC_NOTE for corefiles
Add a new LC_NOTE for Mach-O corefiles, "proces metadata", which is a
JSON string.  Currently there may be a `threads` key in the JSON,
and if `threads` is present, it is an array with the same number of
elements as there are LC_THREADs in the corefile.  This patch adds
support for a `thread_id` key-value for each `thread` entry, to
supply a thread ID for that LC_THREAD.

Differential Revision: https://reviews.llvm.org/D158785
rdar://113037252
2023-09-11 16:46:18 -07:00
Alex Langford
764287f1ad [lldb] Add support for recognizing swift ast sections in object files
In Apple's downstream fork, there is support for understanding the swift
AST sections in various binaries. Even though the lldb on llvm.org does
not have support for debugging swift, I think it makes sense to move
support for recognizing swift ast sections upstream.

Differential Revision: https://reviews.llvm.org/D159142
2023-08-31 15:16:12 -07:00
Jason Molenda
10f494d289 Only set the "low" address masks when only one adressable bits specified
qHostInfo / stop-reply packet / LC_NOTE "addrable bits" can all
specify either a single value for all address masks, or separate
masks for low and high memory addresses.

When the same number of addressing bits are used for all addresses,
we use the "low memory" address masks for everything. (or another
way, if the high address masks are not set, we use the low address
masks with the assumption that all memory is using the same mask --
the most common situation).

I was setting low and high address masks when I had a single value
from these metadata, but that gave the impression that the high
address mask was specified explicitly.  After living on the code
a bit, it's clearly better to only set the high address masks when
we have a distinct high address mask value.

This patch is the minor adjustment to behave that way.
2023-08-17 18:16:31 -07:00
Jason Molenda
6f4a0c762f hi/low addr space bits can be sent in stop-rely packet
Add support for the `low_mem_addressing_bits` and
`high_mem_addressing_bits` keys in the stop reply packet,
in addition to the existing `addressing_bits`.  Same
behavior as in the qHostInfo packet.

Clean up AddressableBits so we don't need to check if
any values have been set in the object before using it
to potentially update the Process address masks.

Differential Revision: https://reviews.llvm.org/D158041
2023-08-16 16:12:18 -07:00
Jason Molenda
3ad618f4ae Update qHostInfo/LC_NOTE so multiple address bits can be specified
On AArch64 systems, we may have different page table setups for
low memory and high memory, and therefore a different number of
bits used for addressing depending on which half of memory the
address is in.

This patch extends the qHostInfo and LC_NOTE "addrable bits" so
that it can specify the number of addressing bits in high memory
and in low memory separately.  It builds on the patch I added in
https://reviews.llvm.org/D151292 where Process tracks the separate
address masks, and there is a user setting to set them manually.

Differential Revision: https://reviews.llvm.org/D157667
rdar://113225907
2023-08-15 13:21:33 -07:00
Alex Langford
f2d32ddcec [lldb] Sink StreamFile into lldbHost
StreamFile subclasses Stream (from lldbUtility) and is backed by a File
(from lldbHost). It does not depend on anything from lldbCore or any of its
sibling libraries, so I think it makes sense for this to live in
lldbHost instead.

Differential Revision: https://reviews.llvm.org/D157460
2023-08-09 17:17:18 -07:00
Jason Molenda
1290869ef2 Show error messages from DebugSymbols DBGShellCommand agent
The DebugSymbols DBGShellsCommand, which can find the symbols
for binaries, has a mechanism to return error messages when
it cannot find a symbol file.  Those errors were not printed
to the user for several corefile use case scenarios; this
patch fixes that.

Also add dyld/process logging for the LC_NOTE metadata parsers
in ObjectFileMachO, to help in seeing what lldb is basing its
searches on.

Differential Revision: https://reviews.llvm.org/D157160
2023-08-08 17:10:20 -07:00
Jason Molenda
57cbd26a68 Flag for LoadBinaryWithUUIDAndAddress, to create memory image or not
DynamicLoader::LoadBinaryWithUUIDAndAddress can create a Module based
on the binary image in memory, which in some cases contains symbol
names and can be genuinely useful.  If we don't have a filename, it
creates a name in the form `memory-image-0x...` with the header address.

In practice, this is most useful with Darwin userland corefiles
where the binary was stored in the corefile in whole, and we can't
find a binary with the matching UUID.  Using the binary out of
the corefile memory in this case works well.

But in other cases, akin to firmware debugging, we merely end up
with an oddly named binary image and no symbols.

Add a flag to control whether we will create these memory images
and add them to the Target or not; only set it to true when working
with a userland Mach-O image with the "all image infos" LC_NOTE for
a userland corefile.

Differential Revision: https://reviews.llvm.org/D157167
2023-08-07 15:19:45 -07:00
Eymen Ünay
aa2784876a [lldb] Fix typo in comments and in test
Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D157214
2023-08-07 12:56:55 +00:00
Alex Langford
db9087a696 [lldb] Clean up uses of UuidCompatibility.h
This commit does a few related things:
- Removes unused function `uuid_is_null`
- Removes unneeded includes of UuidCompatibility.h
- Renames UuidCompatibility to AppleUuidCompatibility and adds a comment
  to clarify intent of header.
- Moves AppleUuidCompatibility to the include directory

Differential Revision: https://reviews.llvm.org/D156562
2023-07-31 10:30:07 -07:00
Jonas Devlieghere
e5aa4cff43
[lldb] Support Compact C Type Format (CTF) section
Teach LLDB about the ctf (Compact C Type Format) section.

Differential revision: https://reviews.llvm.org/D154668
2023-07-13 11:30:35 -07:00
Jason Molenda
623e845591 Recognize BSS-only DATA segments as sections that need to be slid
ObjectFileMachO::SetLoadAddress() should allow for a DATA segment
that has no file content to be slid in the vmaddr, it is valid
to have such a section.

Differential Revision: https://reviews.llvm.org/D154037
rdar://99744343
2023-06-29 17:51:41 -07:00
Felipe de Azevedo Piovezan
1704c8d104 [lldb][MachO] Fix section type recognition for new DWARF 5 sections
When LLDB needs to access a debug section, it generally calls
SectionList::FindSectionByType with the corresponding type (we have one type for
each DWARF section). However, the missing entries made some sections be
classified as "eSectionTypeOther", which makes all calls to `FindSectionByType`
fail.

With this patch, a check-lldb build with
`-DLLDB_TEST_USER_ARGS=--dwarf-version=5` reports a much lower number of
failures:

  Unsupported      :  327
  Passed           : 2423
  Expectedly Failed:   16
  Unresolved       :    2
  Failed           :   52

This is down from previously 400~ failures.

Differential Revision: https://reviews.llvm.org/D153433
2023-06-21 13:25:10 -04:00
Adrian Prantl
27fac4a72a Add support for __debug_line_str in Mach-O
This patch resolves an issue that currently accounts for the vast
majority of failures on the matrix bot.

Differential Revision: https://reviews.llvm.org/D152872
2023-06-14 08:37:08 -07:00
Jason Molenda
48a12ae821 Fix a few bugs with Mach-O corefile loading, plus perf
In ProcessMachCore::LoadBinariesViaMetadata(), if we did
load some binaries via metadata in the core file, don't
then search for a userland dyld in the corefile / kernel
and throw away that binary list.  Also fix a little bug
with correctly recognizing corefiles using a `main bin spec`
LC_NOTE that explicitly declare that this is a userland
corefile.

LocateSymbolFileMacOSX.cpp's Symbols::DownloadObjectAndSymbolFile
clarify the comments on how the force_lookup and how the
dbgshell_command local both have the same effect.

In PlatformDarwinKernel::LoadPlatformBinaryAndSetup, don't
log a message unless we actually found a kernel fileset.

Reorganize ObjectFileMachO::LoadCoreFileImages so that it delegates
binary searching to DynamicLoader::LoadBinaryWithUUIDAndAddress and
doesn't duplicate those searches.  For searches that fail, we would
perform them multiple times in both methods.  When we have the
mach-o segment vmaddrs for a binary, don't let LoadBinaryWithUUIDAndAddress
load the binary first at its mach-o header address in the Target;
we'll load the segments at the correct addresses individually later
in this method.

DynamicLoaderDarwin::ImageInfo::PutToLog fix a LLDB_LOG logging
formatter.

In DynamicLoader::LoadBinaryWithUUIDAndAddress, instead of using
Target::GetOrCreateModule as a way to find a binary already registered
in lldb's global module cache (and implicitly add it to the Target
image list), use ModuleList::GetSharedModule() which only searches
the global module cache, don't add it to the Target.  We may not
want to add an unstripped binary to the Target.

Add a call to Symbols::DownloadObjectAndSymbolFile() even if
"force_symbol_search" isn't set -- this will turn into a
DebugSymbols call / Spotlight search on a macOS system, which
we want.

Only set the Module's LoadAddress if the caller asked us to do that.

Differential Revision: https://reviews.llvm.org/D150928
rdar://109186357
2023-05-30 15:36:40 -07:00
Alex Langford
973f1fe7a8 [lldb][NFCI] Remove unused member from ObjectFileMachO
From what I can see, `m_mach_segments` is completely unused. Let's
remove it.

Differential Revision: https://reviews.llvm.org/D151236
2023-05-23 15:14:47 -07:00
Alex Langford
3c276eaf8f [lldb][NFCI] Merge implementations of ObjectFileMachO::GetMinimumOSVersion and ObjectFileMachO::GetSDKVersion
These functions do the exact same thing (even if they look slightly
different). I yanked the common implementation, cleaned it up, and
shoved it into its own function.

Differential Revision: https://reviews.llvm.org/D151120
2023-05-23 10:26:08 -07:00
Alex Langford
3c4f16b6ca [lldb][NFCI] Consolidate segment names in ObjectFileMachO
We have static functions for each one, we should use them where it makes
sense.
2023-05-19 13:06:40 -07:00
Jason Molenda
f9759d0cb6 Prioritize using a segment with the name TEXT instead off fileoff 0
lldb needs to find the virtual address of the mach header of a
binary.  It first scans for a segment which starts at file offset
0, and uses the vmaddr of that segment.  If no segment starts at
fileoff 0, it looks for a segment named __TEXT.

This patch changes the order of those, to first search for the TEXT
segment.  We have a situation where binaries exist that have the
DATA segment first, which does not have the vmaddr of the mach header,
it merely happens to come first in the binary file.  It's an unusual
arrangement, but not breaking any rules of Mach-O.  So lldb needs
to handle this.

Differential Revision: https://reviews.llvm.org/D150239
rdar://109128418
2023-05-10 16:42:38 -07:00
Jason Molenda
448bd59e18 [nfc] Remove dead code from ObjectFileMachO
The old way of lldb reading the on-disk shared cache is still in
the sources, but we use dyld SPI to inspect this binary now.  This
code is no longer called.
2023-05-09 17:01:06 -07:00
Jonas Devlieghere
917b3a7e62
[lldb] Move Core/FileSpecList -> Utility/FileSpecList (NFC)
There's no reason for FileSpecList to live in lldb/Core while FileSpec
lives in lldb/Utility. Move FileSpecList next to FileSpec.
2023-05-04 22:00:17 -07:00
Jason Molenda
6b6bac2cd8 Fix off-by-one error in armv7 mach-o corefile register context
The sanity check on the size of the register context we found in
the corefile was off by one, so lldb would not add the register
contents.  Add a test case to ensure it doesn't regress.

Differential Revision: https://reviews.llvm.org/D149224
rdar://108306070
2023-04-26 13:06:07 -07:00
Jonas Devlieghere
c1d55d26d3
[lldb] Let Mangled decide whether a name is mangled or not
We have a handful of places in LLDB where we try to outsmart the logic
in Mangled to determine whether a string is mangled or not. There's at
least one place (*) where we are getting this wrong and causes a subtle
bug. The `cstring_is_mangled` is cheap enough that we should always rely
on it to determine whether a string is mangled or not.

(*) `ObjectFileMachO` assumes that a symbol that starts with a double
underscore (such as `__pthread_kill`) is mangled. That's mostly
harmless, until you use `function.name-without-args` in the frame
format. The formatter calls `Symbol::GetNameNoArguments()` which is a
wrapper around `Mangled::GetName(ePreferDemangledWithoutArguments)`. The
latter will first try using the appropriate language plugin to get the
demangled name without arguments, and if that fails, falls back to
returning the demangled name. Because we forced Mangled to treat the
symbol as a mangled name (even though it's not) there's no demangled
name. The result is that frames don't show any symbol at all.

Differential revision: https://reviews.llvm.org/D148846
2023-04-21 10:23:24 -07:00
Kazu Hirata
65a2d6d690 [lldb] Use *{Set,Map}::contains (NFC) 2023-03-14 21:41:40 -07:00
Jason Molenda
7f25c3e25f Slight refinement to a change yesterday in metadata-added binaries
When ObjectFileMachO::LoadCoreFileImages load a binary into the
target with a valid load address, we don't need to re-load its
segments into the Target's SectionLoadList again.  But we should
still call ModulesDidLoad on these modules so breakpoints can be
inserted etc.
2023-03-09 14:56:22 -08:00
Jason Molenda
8db8a4e8ed Clean up conditional, don't set load binaries twice
Follow Alex Langford's feedback to my patch from
https://reviews.llvm.org/D145547 , and fix a
side issue I noticed while testing this, where
binaries loaded via LC_NOTE metadata were loaded
in the Target twice unnecessarily.
2023-03-08 18:02:20 -08:00
Jason Molenda
794d2089cd Don't load non-kexts in darwin kernel debug; handle unslid segs
We have some non-kexts in the binary list in the Darwin kernel
in some situations.  The binary has likely already been loaded;
check if it has been, and don't re-load it.  Also, if we do need
to load it at this point, if in-memory segment vmaddrs have not
been updated to the actual load addresses, calculate a fixed slide
for the in-memory image and apply that slide to the ondisk binary.

Differential Revision: https://reviews.llvm.org/D145547
rdar://106343477
2023-03-08 16:51:27 -08:00