Commit Graph

16022 Commits

Author SHA1 Message Date
Kazu Hirata 2078350645 Use std::make_unsigned_t (NFC) 2022-09-18 18:41:02 -07:00
Emmmer edc1c9f610 [LLDB][RISCV] Add RVM and RVA instruction support for EmulateInstructionRISCV
Add:
- RVM and RVA instructions sets.
- corresponding unittests.

Further work:
- implement RVC, RVF, RVD, and RVV extension.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D133670
2022-09-17 12:19:09 +08:00
Zequan Wu d21b417025 [LLDB][NativePDB] ResolveSymbolContext should return the innermost block
Before, it returns the outermost blocks if nested blocks have the same
address range. That casuses lldb unable to find variables that are inside
inner blocks.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D133601
2022-09-16 10:19:09 -07:00
Zequan Wu 8704281c56 [LLDB][NativePDB] Global ctor and dtor should be global decls.
This fixes a crash that mistaken global ctor/dtor as funciton methods.

Differential Revision: https://reviews.llvm.org/D133446
2022-09-15 22:35:58 -07:00
Jim Ingham f3d0bda534 Revert "Revert "Be more careful to maintain quoting information when parsing commands.""
This reverts commit ac05bc0524.

I had incorrectly removed one set of checks in the option handling in
Options::ParseAlias because I couldn't see what it is for.  It was a
bit obscure, but it handled the case where you pass "-something=other --"
as the input_line, which caused the built-in "run" alias not to return
the right value for IsDashDashCommand, causing TestHelp.py to fail.
2022-09-14 14:49:51 -07:00
Stella Stamenova da459043f8 Revert "[lldb][DWARF5] Enable macro evaluation"
This reverts commit a0fb69d17b.

This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23666
2022-09-14 09:30:49 -07:00
Jordan Rupprecht 1f3def30ca Fix heap-use-after-free when clearing DIEs in fission compile units.
D131437 caused heap-use-after-free failures when testing TestCreateAfterAttach.py in asan mode, and "regular" crashes outside of asan.

This appears to be due to a mismatch in a couple places where we choose to clear the DIEs. When we clear the DIE of a skeleton unit, we unconditionally clear the DIE of the DWO unit if it exists. However, `~ScopedExtractDIEs()` only looks at the skeleton unit when deciding to clear. If we decide to clear the skeleton unit because it is now unused, we end up clearing the DWO unit that _is_ used. This change adds a guard by checking `m_cancel_scopes` to prevent clearing the DWO unit.

This is 100% reproducible by running TestCreateAfterAttach.py in asan mode, although it only seems to reproduce in our internal build, so no test case is added here. If someone has suggestions on how to write one, I can add it.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D133790
2022-09-14 06:52:47 -07:00
Pavel Kosov a0fb69d17b [lldb][DWARF5] Enable macro evaluation
Patch enables handing of DWARFv5 DW_MACRO_define_strx and DW_MACRO_undef_strx

~~~

OS Laboratory. Huawei RRI. Saint-Petersburg

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D130062
2022-09-14 11:32:07 +03:00
Jason Molenda 92bd2e443e Add mach-o corefile support for platform binaries
Add support for recognizing a platform binary in the ObjectFileMachO
method that parses the "load binary" LC_NOTEs in a corefile.

A bit of reorganization to ProcessMachCore::DoLoadCore to separate
all of the unrelated things being done in that method into their own
separate methods, as well as small fixes to improve the handling of
a corefile with multiple kernel images in the corefile.

Differential Revision: https://reviews.llvm.org/D133680
rdar://98754861
2022-09-13 15:46:18 -07:00
Jim Ingham ac05bc0524 Revert "Be more careful to maintain quoting information when parsing commands."
This reverts commit 6c089b2af5.

This was causing the test test_help_run_hides_options from TestHelp.py to
fail on Linux and Windows (but the test succeeds on macOS).  The decision
to print option information is determined by CommandObjectAlias::IsDashDashCommand
which was changed, but only by replacing an inline string constant with a const char *
CommandInterpreter::g_argument which has the same string value.  I can't see why this
would fail, I'll have to spin up a vm to see if I can repo there.
2022-09-13 14:59:21 -07:00
Jim Ingham a2d0a01e3f Revert "constexpr isn't right here."
This didn't help either.

This reverts commit 8433b21083.
2022-09-13 14:58:53 -07:00
Jim Ingham 3f23eb6591 Revert "Trying to understand the TestHelp.py failure from 6c089b2."
It didn't help.

This reverts commit 81f8788528.
2022-09-13 14:58:27 -07:00
Jim Ingham 81f8788528 Trying to understand the TestHelp.py failure from 6c089b2.
Sadly, the test passes on macOS, but fails on Ubuntu & Win.  The
extra option printing is supposed to be suppressed by the return
from CommandObjectAlias::IsDashDashCommand.  That was changed, but just
by replacing an inline string compare with a const string from
CommandInterpreter.  Putting the old version back temporarily to
see if that is really the problem.
2022-09-13 14:09:44 -07:00
Jim Ingham 8433b21083 constexpr isn't right here. 2022-09-13 13:01:56 -07:00
Jorge Gorbe Moya ef3fa232b3 [Formatters][NFCI] Replace 'is_regex' arguments with an enum.
Modify `SBTypeNameSpecifier` and `lldb_private::TypeMatcher` so they
have an enum value for the type of matching to perform instead of an
`m_is_regex` boolean value.

This change paves the way for introducing formatter matching based on
the result of a python callback in addition to the existing name-based
matching. See the RFC thread at
https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204
for more details.

Differential Revision: https://reviews.llvm.org/D133240
2022-09-13 12:50:55 -07:00
Jim Ingham 6c089b2af5 Be more careful to maintain quoting information when parsing commands.
This is particularly a problem for alias construction, where you might
want to have a backtick surrounded option in the alias.  Before this
patch:

command alias expression -Z \`argc\` -- argv

for instance would be rendered as:

expression -Z argc -- argv

and would fail to work.

Differential Revision: https://reviews.llvm.org/D133045
2022-09-13 11:02:47 -07:00
Gabriel Ravier 7240436c94
[lldb] Fixed a number of typos
I went over the output of the following mess of a command:

  (ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel
  --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E
  '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' |
  aspell pipe -W3 | grep : | cut -d' ' -f2 | less)

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Differential revision: https://reviews.llvm.org/D131122
2022-09-13 10:38:38 -07:00
David M. Lary f4fc405631 lldb: Add support for R_386_32 relocations to ObjectFileELF
I encountered an issue where `p &variable` was finding an incorrect address for
32-bit PIC ELF files loaded into a running process.  The problem was that the
R_386_32 ELF relocations were not being applied to the DWARF section, so all
variables in that file were reporting as being at the start of their respective
section.  There is an assert that catches this on debug builds, but silently
ignores the issue on non-debug builds.

In this changeset, I added handling for the R_386_32 relocation type to
ObjectFileELF, and a supporting function to ELFRelocation to differentiate
between DT_REL & DT_RELA in ObjectFileELF::ApplyRelocations().

Demonstration of issue:
```
[dmlary@host work]$ cat rel.c
volatile char padding[32] = "make sure var isnt at .data+0";
volatile char var[] = "test";
[dmlary@host work]$ gcc -c rel.c -FPIC -fpic -g -m32

[dmlary@host work]$ lldb ./exec
(lldb) target create "./exec"
Current executable set to '/home/dmlary/src/work/exec' (i386).
(lldb) process launch --stop-at-entry
Process 21278 stopped
* thread #1, name = 'exec', stop reason = signal SIGSTOP
    frame #0: 0xf7fdb150 ld-2.17.so`_start
ld-2.17.so`_start:
->  0xf7fdb150 <+0>: movl   %esp, %eax
    0xf7fdb152 <+2>: calll  0xf7fdb990                ; _dl_start

ld-2.17.so`_dl_start_user:
    0xf7fdb157 <+0>: movl   %eax, %edi
    0xf7fdb159 <+2>: calll  0xf7fdb140
Process 21278 launched: '/home/dmlary/src/work/exec' (i386)

(lldb) image add ./rel.o
(lldb) image load --file rel.o .text 0x40000000 .data 0x50000000
section '.text' loaded at 0x40000000
section '.data' loaded at 0x50000000

(lldb) image dump symtab rel.o
Symtab, file = rel.o, num_symbols = 13:
               Debug symbol
               |Synthetic symbol
               ||Externally Visible
               |||
Index   UserID DSX Type            File Address/Value Load Address       Size               Flags      Name
------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ----------------------------------
[    0]      1     SourceFile      0x0000000000000000                    0x0000000000000000 0x00000004 rel.c
[    1]      2     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    2]      3     Invalid         0x0000000000000000 0x50000000 0x0000000000000020 0x00000003
[    3]      4     Invalid         0x0000000000000025                    0x0000000000000000 0x00000003
[    4]      5     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    5]      6     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    6]      7     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    7]      8     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    8]      9     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[    9]     10     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[   10]     11     Invalid         0x0000000000000000                    0x0000000000000020 0x00000003
[   11]     12   X Data            0x0000000000000000 0x50000000 0x0000000000000020 0x00000011 padding
[   12]     13   X Data            0x0000000000000020 0x50000020 0x0000000000000005 0x00000011 var

(lldb) p &var
(volatile char (*)[5]) $1 = 0x50000000
```

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D132954
2022-09-13 18:38:48 +02:00
Greg Clayton 376c7bd92a Fix DW_OP_convert to resolve the CU relative offset correctly.
Debugging some DWARF5 binaries was causing errors to appear when DWARFExpression::Evaluate was called:

    error: GetDIE for DIE 0x31 is outside of its CU 0x123450

The issue is in the DWARF expression evaluator. Fixed with this.

Differential Revision: https://reviews.llvm.org/D133623
2022-09-12 16:53:19 -07:00
Greg Clayton 4763200ec9 Add the ability to show when variables fails to be available when debug info is valid.
Summary:
Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience.

Examples of this include:
- enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables
- unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file.

This patch adds an new API to SBValueList:

  lldb::SBError lldb::SBValueList::GetError();

object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available.

This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList.

It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above:

(lldb) frame variable
error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match

Reviewers: labath JDevlieghere aadsm yinghuitan jdoerfert sscalpone

Subscribers:

Differential Revision: https://reviews.llvm.org/D133164
2022-09-12 13:59:05 -07:00
Zequan Wu aedad60231 [LLDB][NativePDB] Add local variables with no location info.
If we don't add local variables with no location info, when trying to print it,
lldb won't find it in the its parent DeclContext, which makes lldb to spend more
time to search all the way up in DeclContext hierarchy until found same name
variable or failed. Dwarf plugin also add local vars even if they don't have
location info.

Differential Revision: https://reviews.llvm.org/D133626
2022-09-12 12:01:24 -07:00
Stella Stamenova 327146639c Revert "Add the ability to show when variables fails to be available when debug info is valid."
This reverts commit 9af089f517.

This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23528
2022-09-12 11:31:17 -07:00
Laura Chaparro-Gutierrez 6f5d109fca [lldb] Add SBBreakpointLocation::SetCallback
* Include SetCallback in SBBreakpointLocation, similar as in SBBreakpoint.
* Add test_breakpoint_location_callback test as part of TestMultithreaded.

Reviewed By: werat, JDevlieghere

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

Co-authored-by: Andy Yankovsky <weratt@gmail.com>
2022-09-12 17:44:02 +00:00
Jeffrey Tan d5f5475104 Add SBDebugger::GetSetting() public APIs
This patch adds new SBDebugger::GetSetting() API which
enables client to access settings as SBStructedData.

Implementation wise, a new ToJSON() virtual function is added to OptionValue
class so that each concrete child class can override and provides its
own JSON representation. This patch aims to define the APIs and implement
a common set of OptionValue child classes, leaving the remaining for
future patches.

This patch is used later by auto deduce source map from source line breakpoint
feature for testing generated source map entries.

Differential Revision: https://reviews.llvm.org/D133038
2022-09-11 20:50:03 -07:00
Jason Molenda 30578c0856 dependency cycle fix in DynamicLoaderDarwinKernel
DynamicLoaderDarwinKernel calls in to PlatformDarwinKernel, and
with my changes in https://reviews.llvm.org/D133534, PlatformDarwinKernel
calls in to DynamicLoaderDarwinKernel.  This results in a cmake
dependency if accurately included in the link libraries list.

lldbPluginDynamicLoaderDarwinKernel is specfically for kernel
debugging and is uncommonly linked in to anything except a full
lldb.  lldbPluginPlatformMacOSX is any Darwin platform, including
PlatformDarwinKernel, and is referenced a number of time in shell
tests, for instance.

I believe anything linking the darwin kernel DynamicLoader plugin
will already have lldbPluginPlatformMacOSX in its dependency list,
so not explicitly expressing this dependency is safe.
2022-09-09 17:37:46 -07:00
Greg Clayton 9af089f517 Add the ability to show when variables fails to be available when debug info is valid.
Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience.

Examples of this include:
- enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables
- unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file.

This patch adds an new API to SBValueList:

  lldb::SBError lldb::SBValueList::GetError();

object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available.

This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList.

It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above:

(lldb) frame variable
error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match

Differential Revision: https://reviews.llvm.org/D133164
2022-09-09 16:14:46 -07:00
Adrian Prantl 2f4a66eed6 Adapt LLDB dataformatters for libcxx change D129386
Differential Revision: https://reviews.llvm.org/D133618
2022-09-09 15:58:55 -07:00
Zequan Wu 6037936989 [LLDB][NativePDB] Replace blocks.cpp with blocks.s so the test won't be affected by codegen changes. 2022-09-09 15:47:27 -07:00
Jason Molenda 1a608cfb5c Recognize a platform binary in ProcessGDBRemote which determines plugins
Complete support of the binary-addresses key in the qProcessInfo packet
in ProcessGDBRemote, for detecting if one of the binaries needs to be
handled by a Platform plugin, and can be used to set the Process'
DynamicLoader plugin and the Target's Platform plugin.

Implement this method in PlatformDarwinKernel to recognize a kernel
fileset at that address, find the actual kernel address in the
fileset, set DynamicLoaderDarwinKernel and PlatformDarwinKernel
in the Process/Target; register the kernel address with the dynamic
loader so it will be loaded later during attach.

This patch only addresses the live debug scenario with a gdb remote
serial protocol connection. I'll handle corefiles in a subsequent
patch that builds on this.

Differential Revision: https://reviews.llvm.org/D133534
rdar://98754861
2022-09-09 14:57:08 -07:00
Michał Górny bdb4468d39 [gdb-remote] Move broadcasting logic down to GDBRemoteClientBase
Move the broadcasting support from GDBRemoteCommunication
to GDBRemoteClientBase since this is where it is actually used.  Remove
GDBRemoteCommunication and subclass constructor arguments left over
after Communication cleanup.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D133427
2022-09-09 17:13:08 +02:00
Pavel Labath 681d0d9e5f [lldb-server] Report launch error in vRun packets
Uses our existing "error string" extension to provide a better
indication of why the launch failed (the client does not make use of the
error yet).

Also, fix the way we obtain the launch error message (make sure we read
the whole message, and skip trailing garbage), and reduce the size of
TestLldbGdbServer by splitting some tests into a separate file.

Differential Revision: https://reviews.llvm.org/D133352
2022-09-09 15:10:38 +02:00
Pavel Labath 89a3691b79 [lldb] Fix ThreadedCommunication races
The Read function could end up blocking if data (or EOF) arrived just as
it was about to start waiting for the events. This was only discovered
now, because we did not have unit tests for this functionality before.
We need to check for data *after* we start listening for incoming
events. There were no changes to the read thread code needed, as we
already use this pattern in SynchronizeWithReadThread, so I just updated
the comments to make it clear that it is used for reading as well.

Differential Revision: https://reviews.llvm.org/D133410
2022-09-09 15:10:38 +02:00
Zequan Wu 32530e0493 [LLDB][NativePDB] Set block address range.
The block address range was missing before.

Differential Revision: https://reviews.llvm.org/D133461
2022-09-08 14:51:47 -07:00
Joe Loser 47b76631e7 [lldb] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.

Change call sites to use `std::size` instead.

Differential Revision: https://reviews.llvm.org/D133501
2022-09-08 14:21:55 -06:00
Zequan Wu 9b825dcdb2 [LLDB][NativePDB] Fix PdbAstBuilder::GetParentDeclContext when ICF happens.
Removed `GetParentDeclContextForSymbol` as this is not necesssary. We can get
the demangled names from CVSymbol and then using it to create tag decl or
namespace decl. This also fixed a bug when icf applied.

Differential Revision: https://reviews.llvm.org/D133243
2022-09-08 10:42:12 -07:00
Jim Ingham 9690308f78 Fix another place were we suggest lldb.target in a Frame Recognizer. 2022-09-06 13:24:21 -07:00
Dave Lee 940704cc58 [lldb] Fix CommunicationKDP following D133251
Add `m_bytes` and `m_bytes_mutex` to `CommunicationKDP`, following refactoring
in D133251.

Differential Revision: https://reviews.llvm.org/D133365
2022-09-06 10:48:12 -07:00
Michał Górny 9823d42557 [lldb] [Core] Split read thread support into ThreadedCommunication
Split the read thread support from Communication into a dedicated
ThreadedCommunication subclass.  The read thread support is used only
by a subset of Communication consumers, and it adds a lot of complexity
to the base class.  Furthermore, having a dedicated subclass makes it
clear whether a particular consumer needs to account for the possibility
of read thread being running or not.

The modules currently calling `StartReadThread()` are updated to use
`ThreadedCommunication`.  The remaining modules use the simplified
`Communication` class.

`SBCommunication` is changed to use `ThreadedCommunication` in order
to avoid changing the public API.

`CommunicationKDP` is updated in order to (hopefully) compile with
the new code.  However, I do not have a Darwin box to test it, so I've
limited the changes to the bare minimum.

`GDBRemoteCommunication` is updated to become a `Broadcaster` directly.
Since it does not inherit from `ThreadedCommunication`, its event
support no longer collides with the one used for read thread and can
be implemented cleanly.  The support for
`eBroadcastBitReadThreadDidExit` is removed from the code -- since
the read thread was not used, this event was never reported.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D133251
2022-09-06 13:09:42 +02:00
Pavel Labath 6a8bbd26ab [lldb] Enable the insertion of "pending callbacks" to MainLoops from other threads
This will be used as a replacement for selecting over a pipe fd, which
does not work on windows. The posix implementation still uses a pipe
under the hood, while the windows version uses windows event handles.

The idea is that, instead of writing to a pipe, one just inserts a
callback, which does whatever you wanted to do after the bytes come out
the read end of the pipe.

Differential Revision: https://reviews.llvm.org/D131160
2022-09-06 10:56:10 +02:00
Kazu Hirata ff2fe7b829 Use llvm::upper_bound (NFC) 2022-09-03 11:17:39 -07:00
Kazu Hirata 89f1433225 Use llvm::lower_bound (NFC) 2022-09-03 11:17:37 -07:00
Jorge Gorbe Moya f021cb57ce [NFC] Remove duplicate code in SBTypeCategory
TypeCategoryImpl has its own implementation of these, so it makes no
sense to have the same logic inlined in SBTypeCategory.

There are other methods in SBTypeCategory that are directly implemented
there, instead of delegating to TypeCategoryImpl (which IMO kinda
defeats the point of having an "opaque" member pointer in the SB type),
but they don't have equivalent implementations in TypeCategoryImpl, so
this patch only picks the low-hanging fruit for now.
2022-09-02 16:04:04 -07:00
Dave Lee a2ec18ee04 [lldb] From unordered_map synthetic provider, return std::pair children
Change the behavior of the libc++ `unordered_map` synthetic provider to present
children as `std::pair` values, just like `std::map` does.

The synthetic provider for libc++ `std::unordered_map` has returned children
that expose a level of internal structure (over top of the key/value pair). For
example, given an unordered map initialized with `{{1,2}, {3, 4}}`, the output
is:

```
(std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<const int, int> > >) map = size=2 {
  [0] = {
    __cc = (first = 3, second = 4)
  }
  [1] = {
    __cc = (first = 1, second = 2)
  }
}
```

It's not ideal/necessary to have the numbered children embdedded in the `__cc`
field.

Note: the numbered children have type
`std::__hash_node<std::__hash_value_type<Key, T>, void *>::__node_value_type`,
and the `__cc` fields have type `std::__hash_value_type<Key, T>::value_type`.

Compare this output to `std::map`:

```
(std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > >) map = size=2 {
  [0] = (first = 1, second = 2)
  [1] = (first = 3, second = 4)
```

Where the numbered children have type `std::pair<const Key, T>`.

This changes the behavior of the synthetic provider for `unordered_map` to also
present children as `pairs`, just like `std::map`.

It appears the synthetic provider implementation for `unordered_map` was meant
to provide this behavior, but was maybe incomplete (see
d22a94377f). It has both an `m_node_type` and an
`m_element_type`, but uses only the former. The latter is exactly the type
needed for the children pairs. With this existing code, it's not much of a
change to make this work.

Differential Revision: https://reviews.llvm.org/D117383
2022-09-02 08:53:46 -07:00
Kazu Hirata 4535dbd559 [lldb] Fix a warning
This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h:51:5:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2022-09-01 22:14:25 -07:00
Emmmer ff7b876aa7 [LLDB][RISCV] Add more instruction decode and execute for EmulateInstructionRISCV
Add:
- most of instructions from RVI base instructions set.
- some instruction decode tests from objdump.

Further work:
- implement riscv imac extension.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D132789
2022-09-02 10:17:09 +08:00
Adrian Prantl ced4e0006f Fix inconsistent target arch when attaching to arm64 binaries on
arm64e platforms.

On arm64e-capable Apple platforms, the system libraries are always
arm64e, but applications often are arm64. When a target is created
from file, LLDB recognizes it as an arm64 target, but debugserver will
still (technically correct) report the process as being arm64e. For
consistency, set the target to arm64 here.

rdar://92248684

Differential Revision: https://reviews.llvm.org/D133069
2022-09-01 16:39:35 -07:00
Zequan Wu afeb2d0a21 [LLDB][NativePDB] Fix a minor bug.
llvm::codeview::visitMemberRecordStream in CompleteTagDecl will call
GetOrCreateType create type if not seen before, which inserts new entries
into m_decl_to_status. This may invalidates status which is a reference to
std::pair::second from DenseMapIterator.
2022-09-01 13:10:57 -07:00
Michał Górny 39e0a87c26 [lldb] [Core] Pass error/status from Communication::ReadThread()
Ensure that the ConnectionStatus and Status from
Communication::ReadThread() is correctly passed to ::Read() in order
to fix further discrepancies between ::Read() calls in non-threaded
and threaded modes.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D132577
2022-09-01 14:16:38 +02:00
Jonas Devlieghere 0044cb4b20
[lldb] Fix two bugs in ObjectContainerMachOFileset
Fix two small issues in the live-memory variant of ObjectContainerMachOFileset.

Differential revision: https://reviews.llvm.org/D132973
2022-08-30 14:07:20 -07:00
Jim Ingham 5ad6ed0e55 Change the meaning of a UUID with all zeros for data.
Previously, depending on how you constructed a UUID from data or a
StringRef, an input value of all zeros was valid (e.g. setFromData)
or not (e.g. setFromOptionalData).  Since there was no way to tell
which interpretation to use, it was done somewhat inconsistently.
This standardizes the meaning of a UUID of all zeros to Not Valid,
and removes all the Optional methods and their uses, as well as the
static factories that supported them.

Differential Revision: https://reviews.llvm.org/D132191
2022-08-30 10:17:58 -07:00