Commit Graph

5684 Commits

Author SHA1 Message Date
Greg Clayton 3db7cc1ba4 Fix a double debug info size counting in top level stats for "statistics dump".
This mainly affects Darwin targets (macOS, iOS, tvOS and watchOS) when these targets don't use dSYM files and the debug info was in the .o files. All modules, including the .o files that are loaded by the debug maps, were in the global module list. This was great because it allows us to see each .o file and how much it contributes. There were virtual functions on the SymbolFile class to fetch the symtab/debug info parse and index times, and also the total debug info size. So the main executable would add all of the .o file's stats together and report them as its own data. Then the "totalDebugInfoSize" and many other "totalXXX" top level totals were all being added together. This stems from the fact that my original patch only emitted the modules for a target at the start of the patch, but as comments from the reviews came in, we switched to emitting all of the modules from the global module list.

So this patch fixes it so when we have a SymbolFileDWARFDebugMap that loads .o files, the main executable will have no debug info size or symtab/debug info parse/index times, but each .o file will have its own data as a separate module. Also, to be able to tell when/if we have a dSYM file I have added a "symbolFilePath" if the SymbolFile for the main modules path doesn't match that of the main executable. We also include a "symbolFileModuleIdentifiers" key in each module if the module does have multiple lldb_private::Module objects that contain debug info so that you can track down the information for a module and add up the contributions of all of the .o files.

Tests were added that are labeled with @skipUnlessDarwin and @no_debug_info_test that test all of this functionality so it doesn't regress.

For a module with a dSYM file, we can see the "symbolFilePath" is included:
```
  "modules": [
    {
      "debugInfoByteSize": 1070,
      "debugInfoIndexLoadedFromCache": false,
      "debugInfoIndexSavedToCache": false,
      "debugInfoIndexTime": 0,
      "debugInfoParseTime": 0,
      "identifier": 4873280600,
      "path": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_dsym_binary_has_symfile_in_stats/a.out",
      "symbolFilePath": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_dsym_binary_has_symfile_in_stats/a.out.dSYM/Contents/Resources/DWARF/a.out",
      "symbolTableIndexTime": 7.9999999999999996e-06,
      "symbolTableLoadedFromCache": false,
      "symbolTableParseTime": 7.8999999999999996e-05,
      "symbolTableSavedToCache": false,
      "triple": "arm64-apple-macosx12.0.0",
      "uuid": "E1F7D85B-3A42-321E-BF0D-29B103F5F2E3"
    },
```
And for the DWARF in .o file case we can see the "symbolFileModuleIdentifiers" in the executable's module stats:
```
  "modules": [
    {
      "debugInfoByteSize": 0,
      "debugInfoIndexLoadedFromCache": false,
      "debugInfoIndexSavedToCache": false,
      "debugInfoIndexTime": 0,
      "debugInfoParseTime": 0,
      "identifier": 4603526968,
      "path": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_no_dsym_binary_has_symfile_identifiers_in_stats/a.out",
      "symbolFileModuleIdentifiers": [
        4604429832
      ],
      "symbolTableIndexTime": 7.9999999999999996e-06,
      "symbolTableLoadedFromCache": false,
      "symbolTableParseTime": 0.000112,
      "symbolTableSavedToCache": false,
      "triple": "arm64-apple-macosx12.0.0",
      "uuid": "57008BF5-A726-3DE9-B1BF-3A9AD3EE8569"
    },
```
And the .o file for 4604429832 looks like:
```
    {
      "debugInfoByteSize": 1028,
      "debugInfoIndexLoadedFromCache": false,
      "debugInfoIndexSavedToCache": false,
      "debugInfoIndexTime": 0,
      "debugInfoParseTime": 6.0999999999999999e-05,
      "identifier": 4604429832,
      "path": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_no_dsym_binary_has_symfile_identifiers_in_stats/main.o",
      "symbolTableIndexTime": 0,
      "symbolTableLoadedFromCache": false,
      "symbolTableParseTime": 0,
      "symbolTableSavedToCache": false,
      "triple": "arm64-apple-macosx"
    }
```

Differential Revision: https://reviews.llvm.org/D119400
2022-02-10 10:55:18 -08:00
David Spickett 2937b28218 Reland "[lldb] Remove non address bits when looking up memory regions"
This reverts commit 0df522969a.

Additional checks are added to fix the detection of the last memory region
in GetMemoryRegions or repeating the "memory region" command when the
target has non-address bits.

Normally you keep reading from address 0, looking up each region's end
address until you get LLDB_INVALID_ADDR as the region end address.
(0xffffffffffffffff)

This is what the remote will return once you go beyond the last mapped region:
[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
[0x0001000000000000-0xffffffffffffffff) ---

Problem is that when we "fix" the lookup address, we remove some bits
from it. On an AArch64 system we have 48 bit virtual addresses, so when
we fix the end address of the [stack] region the result is 0.
So we loop back to the start.

[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
[0x0000000000000000-0x0000000000400000) ---

To fix this I added an additional check for the last range.
If the end address of the region is different once you apply
FixDataAddress, we are at the last region.

Since the end of the last region will be the last valid mappable
address, plus 1. That 1 will be removed by the ABI plugin.

The only side effect is that on systems with non-address bits, you
won't get that last catch all unmapped region from the max virtual
address up to 0xf...f.

[0x0000fffff8000000-0x0000fffffffdf000) ---
[0x0000fffffffdf000-0x0001000000000000) rw- [stack]
<ends here>

Though in some way this is more correct because that region is not
just unmapped, it's not mappable at all.

No extra testing is needed because this is already covered by
TestMemoryRegion.py, I simply forgot to run it on system that had
both top byte ignore and pointer authentication.

This change has been tested on a qemu VM with top byte ignore,
memory tagging and pointer authentication enabled.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D115508
2022-02-10 10:42:49 +00:00
Med Ismail Bennani d327108d17 [lldb/test] Split Scripted Process test in multiple tests (NFC)
This splits the scripted process tests to be able to run in parallel
since some of test functions can take a very long time to run.

This also disables debug info testing.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-02-09 13:28:20 -08:00
Med Ismail Bennani f5e5074c40 [lldb/test] Fix TestScriptedProcess.py timeout on x86_64
This patch fixes a timeout issue on the ScriptedProcess test that was
happening on intel platforms. The timeout was due to a misreporting of
the StopInfo in the ScriptedThread that caused the ScriptedProcess to
never stop.

To solve this, this patch changes the way a ScriptedThread reports its
stop reason by making it more architecture specific. In order to do so,
this patch also refactors the ScriptedProcess & ScriptedThread
initializer methods to provide an easy access to the target architecture.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-02-09 13:28:20 -08:00
Andy Yankovsky e0f2375b52 [lldb] Disable failing test on Windows
Test was introduced in https://reviews.llvm.org/D113498.
2022-02-09 20:40:50 +01:00
Pavel Labath 1046b726ad [lldb] Account for extra threads in TestGdbRemoteThreadsInStopReply on windows
After 9611282c, TestGdbRemoteThreadsInStopReply is not non-deterministic
-- instead it deterministically fails due to extra threads created by
std::thread thread pool.

Adjust the tests to account for that.
2022-02-09 17:42:54 +01:00
Andy Yankovsky afb446e8a6 [lldb] Constant-resolve operands to `getelementptr`
Operands to `getelementptr` can be constants or constant expressions. Check
that all operands can be constant-resolved and resolve them during the
evaluation. If some operands can't be resolved as constants -- the expression
evaluation will fallback to JIT.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=52449

Reviewed By: #lldb, shafik

Differential Revision: https://reviews.llvm.org/D113498
2022-02-09 17:38:38 +01:00
Pavel Labath 9611282c64 [lldb] Stabilize threaded windows lldb-server tests
The tests enabled in 9e699595 are not passing reliably -- sometimes they
report seeing fewer threads than expected.

Based on my (limited) research, this is not a lldb bug, but simply a
consequence of the operating system reporting their presence
asynchronously -- they're reported when they are scheduled to run (or
something similar), and not at the time of the CreateThread call.

To fix this, I add some additional synchronization to the test inferior,
which makes sure that the created thread is alive before continuing to
do other things.
2022-02-09 16:18:27 +01:00
Muhammad Omair Javaid 73a961b9cc [LLDB] Port toolchain-msvc.test for Arm/AArch4 Windows
This patch updates toolchain-msvc.test to cater for Arm64 windows platform.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D117676
2022-02-09 17:40:39 +05:00
Pavel Labath 29caa8583f [lldb] Restore original meaning to test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt
D119167 changed the meaning of that test by removing the use of the
interrupt packet. I did not notice this because the interrupting
happened in a shared utility function.

This patch restores the original meaning of the test, but (almost)
avoids sleeps by using process stdout to synchronize. Sadly, this means
the test stays disabled on windows, as it does not implement output
forwarding.
2022-02-09 12:34:55 +01:00
Pavel Labath 9e6995957a [lldb] Adjust windows xfails for D119167
A couple of additional tests pass with that patch. One new test fails
(because it's not testing a slightly different thing). I'll update it
later to restore the original meaning (I don't want to revert as the net
effect is still very positive), but for now this gets the bot green.
2022-02-09 12:04:13 +01:00
Pavel Labath 5a4fe166d1 [lldb/test] Remove sleeps from some lldb-server tests
Instead of using sleeps, have the inferior notify us (via a trap opcode) that
the requested number of threads have been created.

This allows us to get rid of some fairly dodgy test utility code --
wait_for_thread_count seemed like it was waiting for the threads to
appear, but it never actually let the inferior run, so it only succeeded
if the threads were already started when the function was called. Since
the function was called after a fairly small delay (1s, usually), this
is probably the reason why the tests were failing on some bots.

Differential Revision: https://reviews.llvm.org/D119167
2022-02-09 11:05:02 +01:00
Dave Lee f8d889a789 [lldb] Print message after loading 'crashlog' command
Previously, importing `crashlog` resulted in a message being printed. The
message was about other commands (those in heap.py), not `crashlog`. The
changes in D117237 made it so that the heap.py messages were printed only when
importing `lldb.macosx.heap`, not when importing `lldb.macosx.crashlog`. Some
users may see no output and think `crashlog` wasn't successfully loaded. This
ensures users see that `crashlog` is loaded.

rdar://88283132

Differential Revision: https://reviews.llvm.org/D119155
2022-02-07 12:34:12 -08:00
Jonas Devlieghere a5a71b139c [lldb] Fix Lua/watchpoint_callback.test on Apple Silicon
As Pavel pointed out, on Apple Silicon "b main" stops at a point after
the variable has already been initialized. This patch updates the test
case to avoids that. I've also split the test into separate files so its
easier to reproduce the individual scenarios without having to build any
shared state.
2022-02-07 12:08:24 -08:00
Adrian Prantl 677182fe98 Revert "Add llgs category to all tests in TestLldbGdbServer that attach to the process."
This reverts commit d42765b3be.
2022-02-07 09:42:07 -08:00
Jonas Devlieghere 0d16652021 [lldb] Skip part of TestGdbRemoteMemoryAllocation.py on Apple Silicon
Skip the part of TestGdbRemoteMemoryAllocation.py that attempts to
allocate both writable and executable memory.
2022-02-07 09:41:38 -08:00
Adrian Prantl d42765b3be Add llgs category to all tests in TestLldbGdbServer that attach to the process. 2022-02-07 08:26:48 -08:00
Jonas Devlieghere d63dfa14d6 [lldb] Update outdated comment in TestDyldTrieSymbols.py
After aed965d55d we no longer demangle and store the full name. The
test was updated accordingly but the comment still specified that we
should be able to find the symbol by its full demangled name.
2022-02-07 08:13:54 -08:00
Adrian Prantl 11d64edbf9 Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"
This reverts commit 867fdec194.
2022-02-05 14:54:41 -08:00
Adrian Prantl a701dc8eda Revert "Fixed typos in TestLldbGdbServer.py"
This reverts commit cf93a08575.
2022-02-05 14:54:37 -08:00
Jonas Devlieghere aed965d55d [lldb] Don't construct the demangled strings while indexing the symbol table
The symbol table needs to demangle all symbol names when building its
index. However, this doesn't require the full mangled name: we only need
the base name and the function declaration context. Currently, we always
construct the demangled string during indexing and cache it in the
string pool as a way to speed up future lookups.

Constructing the demangled string is by far the most expensive step of
the demangling process, because the output string can be exponentially
larger than the input and unless you're dumping the symbol table, many
of those demangled names will not be needed again.

This patch avoids constructing the full demangled string when we can
partially demangle. This speeds up indexing and reduces memory usage.

I gathered some numbers by attaching to Slack:

Before
------

  Memory usage: 280MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.829 s ±  0.518 s    [User: 4.012 s, System: 0.208 s]
    Range (min … max):    4.624 s …  6.294 s    10 runs

After
-----

  Memory usage: 189MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.182 s ±  0.025 s    [User: 3.536 s, System: 0.192 s]
    Range (min … max):    4.152 s …  4.233 s    10 runs

Differential revision: https://reviews.llvm.org/D118814
2022-02-04 10:17:39 -08:00
Zequan Wu 607ffa5515 [LLDB] Fix window bot failure
This attempts to fix this bot failure: https://lab.llvm.org/buildbot/#/builders/83/builds/14736 caused by D118750 by un-xfail those expected failed tests.

Differential Revision: https://reviews.llvm.org/D118866
2022-02-03 11:27:48 -08:00
Zequan Wu f3e1ba1d03 [LLDB] add sub regigter enums on x64 Windows
Differential Revision: https://reviews.llvm.org/D118750
2022-02-02 14:21:08 -08:00
Michał Górny 287ce6b516 [lldb] [Commands] Implement "thread siginfo"
Differential Revision: https://reviews.llvm.org/D118473
2022-02-02 19:31:44 +01:00
Jonas Devlieghere d329dfd0c8 [lldb] Use the build's python interpreter in the shell tests
Make sure that the shell tests use the same python interpreter as the
rest of the build instead of picking up `python` from the PATH.

It would be nice if we could use the _disallow helper, but that triggers
on invocations that specify python as the scripting language.
2022-01-31 16:53:42 -08:00
Jonas Devlieghere e1cad1303b [lldb] Support Rosetta registers in crashlog.py
Rosetta crashlogs can have their own thread register state. Unlike the
other registers which ware directly listed under "threadState", the
Rosetta registers are nested under their own key in the JSON, as
illustrated below:

  {
      "threadState":
      {
          "rosetta":
          {
              "tmp2":
              {
                  "value": 4935057216
              },
              "tmp1":
              {
                  "value": 4365863188
              },
              "tmp0":
              {
                  "value": 18446744073709551615
              }
          }
      }
  }
2022-01-31 10:50:16 -08:00
Michał Górny ac666d1799 [lldb] [gdb-remote] Support getting siginfo via API
Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve
the siginfo value from server.

Differential Revision: https://reviews.llvm.org/D118055
2022-01-28 17:47:47 +01:00
Michał Górny 59a3f65f5e Revert "[lldb] [gdb-remote] Support getting siginfo via API"
This reverts commit 1a8f60f5f5.
The API requires further work.
2022-01-28 10:15:52 +01:00
Shubham Sandeep Rastogi cf93a08575 Fixed typos in TestLldbGdbServer.py
Fixed more typos
2022-01-27 14:12:24 -08:00
Shubham Sandeep Rastogi 867fdec194 Disable TestLldbGdbServer on Dwarf2 and clang versions below 14
We have been noticing issues with the lldb bots on builds using versions below clang 14 and dwarf 2, so to make sure we can get clean builds for a while, we are disabling the tests for those versions

Differential Revision: https://reviews.llvm.org/D118395
2022-01-27 14:02:35 -08:00
Shubham Sandeep Rastogi ee54868a76 Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"
This reverts commit cd31763770.
2022-01-27 13:36:21 -08:00
Shubham Sandeep Rastogi cd31763770 Disable TestLldbGdbServer on Dwarf2 and clang versions below 14
We have been noticing issues with the lldb bots on builds using versions below clang 14 and dwarf 2, so to make sure we can get clean builds for a while, we are disabling the tests for those versions

Differential Revision: https://reviews.llvm.org/D118395
2022-01-27 13:29:34 -08:00
Med Ismail Bennani 48c36a15a3 [lldb/test] Disable test_launch_scripted_process_stack_frames on x86_64
There seems to be an issue on x86_64 when launching a ScriptdProcess.
This disables temporarely the test that causes the bot to timeout until
I finish investigating the issue.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-27 18:42:08 +01:00
Pavel Labath 33eb3f14eb [lldb] Delete TestBacktraceAll.py
This test is completely nondeterministic, environment-dependent and does
not test what it was supposed to test (reverting the associated patch
does not make it fail).

I tried to figure out what the patch was meant to fix to see if I can
create a better test with the current tools, but I was not able to
understand the problem (it sounds like it has something to do with local
classes, but I don't understand the details).
2022-01-27 15:01:08 +01:00
Michał Górny 1a8f60f5f5 [lldb] [gdb-remote] Support getting siginfo via API
Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve
the siginfo value from server.

Differential Revision: https://reviews.llvm.org/D118055
2022-01-27 13:33:47 +01:00
Pavel Labath 4cd8877a34 [lldb/test] Fix gnu-style-compression.yaml
In the rush to get the bot green, I did not realize I was building the
file with -gsplit-dwarf, and therefore the yaml ended up referring to a
file I did not check it.

This rebuilds the file without split dwarf.
2022-01-27 10:23:21 +01:00
Pavel Labath aaa9f40e3f [lldb/test] Replace gnu-style-compression.cpp with a yaml file
In D117744, llvm removed writing support for this format, breaking the
test. We may eventually want to remove reading support as well, but for
now I have converted the test to a yaml file to maintain coverage.
2022-01-27 10:05:05 +01:00
Med Ismail Bennani aae3c4f2b4
[lldb/test] Skip TestSBModule unless darwin
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-27 01:05:12 +01:00
Med Ismail Bennani a6b5624372 Revert "[lldb/test] Try to fix TestSBModule failure"
This reverts commit 326516448c.
2022-01-27 01:04:38 +01:00
Med Ismail Bennani 326516448c [lldb/test] Try to fix TestSBModule failure
This should fix https://lab.llvm.org/buildbot/#/builders/68/builds/25571

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-27 01:00:29 +01:00
Med Ismail Bennani ff52ef334b
[lldb/API] Add ability to check if module is backed by a file on disk
This patch introduces a new SBAPI method: `SBModule::IsFileBacked`

As the name suggests, it tells the user if the module's object file is
on disk or in memory.

rdar://68538278

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-26 20:40:24 +01:00
David Spickett 070090d08e [lldb] Add option to show memory tags in memory read output
This adds an option --show-tags to "memory read".

(lldb) memory read mte_buf mte_buf+32 -f "x" -s8 --show-tags
0x900fffff7ff8000: 0x0000000000000000 0x0000000000000000 (tag: 0x0)
0x900fffff7ff8010: 0x0000000000000000 0x0000000000000000 (tag: 0x1)

Tags are printed on the end of each line, if that
line has any tags associated with it. Meaning that
untagged memory output is unchanged.

Tags are printed based on the granule(s) of memory that
a line covers. So you may have lines with 1 tag, with many
tags, no tags or partially tagged lines.

In the case of partially tagged lines, untagged granules
will show "<no tag>" so that the ordering is obvious.
For example, a line that covers 2 granules where the first
is not tagged:

(lldb) memory read mte_buf-16 mte_buf+16 -l32 -f"x" --show-tags
0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0)

Untagged lines will just not have the "(tags: ..." at all.
Though they may be part of a larger output that does have
some tagged lines.

To do this I've extended DumpDataExtractor to also print
memory tags where it has a valid execution context and
is asked to print them.

There are no special alignment requirements, simply
use "memory read" as usual. All alignment is handled
in DumpDataExtractor.

We use MakeTaggedRanges to find all the tagged memory
in the current dump, then read all that into a MemoryTagMap.

The tag map is populated once in DumpDataExtractor and re-used
for each subsequently printed line (or recursive call of
DumpDataExtractor, which some formats do).

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D107140
2022-01-26 14:40:39 +00:00
Jonas Devlieghere cd8122b27f [lldb] Add ConstString memory usage statistics
Add statistics about the memory usage of the string pool. I'm
particularly interested in the memory used by the allocator, i.e. the
number of bytes actually used by the allocator it self as well as the
number of bytes allocated through the allocator.

Differential revision: https://reviews.llvm.org/D117914
2022-01-24 15:13:17 -08:00
Med Ismail Bennani c3ca2c6b14
[lldb/test] Fix `TestScriptedProcess.test_scripted_process_and_scripted_thread`
This patch updates `dummy_scripted_process.py` to report the dummy
thread correctly to reflect the changes introduced by `d3e0f7e`.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-24 21:48:31 +01:00
Med Ismail Bennani cfa55bfe78 [lldb/Plugins] Enrich ScriptedThreads Stop Reasons with Exceptions
This patch adds Exceptions to the list of supported stop reasons for
Scripted Threads.

The main motivation for this is that breakpoints are triggered as a
special exception class on ARM platforms, so adding it as a stop reason
allows the ScriptedProcess to selected the ScriptedThread that stopped at
a breakpoint (or crashed :p).

rdar://87430376

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-24 20:25:54 +01:00
Med Ismail Bennani d3e0f7e150 [lldb/Plugins] Add support of multiple ScriptedThreads in a ScriptedProcess
This patch adds support of multiple Scripted Threads in a ScriptedProcess.

This is done by fetching the Scripted Threads info dictionary at every
ScriptedProcess::DoUpdateThreadList and iterate over each element to
create a new ScriptedThread using the object instance, if it was not
already available.

This patch also adds the ability to pass a pointer of a script interpreter
object instance to initialize a ScriptedInterface instead of having to call
the script object initializer in the ScriptedInterface constructor.

This is used to instantiate the ScriptedThreadInterface from the
ScriptedThread constructor, to be able to perform call on that script
interpreter object instance.

Finally, the patch also updates the scripted process test to check for
multiple threads.

rdar://84507704

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-24 20:25:53 +01:00
David Spickett 7d19566c3b [lldb] Ignore non-address bits in "memory find" arguments
This removes the non-address bits before we try to use
the addresses.

Meaning that when results are shown, those results won't
show non-address bits either. This follows what "memory read"
has done. On the grounds that non-address bits are a property
of a pointer, not the memory pointed to.

I've added testing and merged the find and read tests into one
file.

Note that there are no API side changes because "memory find"
does not have an equivalent API call.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D117299
2022-01-24 10:42:49 +00:00
David Blaikie 8b280df504 Rough guess at fixing lldb tests to handle Clang defaulting to DWARFv5 2022-01-23 21:24:25 -08:00
Dave Lee b95150418f [lldb] Allow aliases to aliases of raw input commands
Allow users to create aliases for aliases to raw input commands. That probably
sounds convoluted, so here's an example:

```
command alias some-setup env SOMEVAR=SOMEVALUE
```

This an alias based on `env`, which itself is an alias for `_regex-env`.
`_regex-env` is a `command regex` command, which takes raw input.

The above `some-setup` alias fails with:

```
error: Unable to create requested alias.
```

This change allows such aliases to be created. lldb already supports aliases to
aliases for parsed commands.

Differential Revision: https://reviews.llvm.org/D117259
2022-01-21 17:57:34 -08:00
David Spickett 787f91b0bb [lldb] Remove non-address bits from addresses given to memory tag commands
Although the memory tag commands use a memory tag manager to handle
addresses, that only removes the top byte.

That top byte is 4 bits of memory tag and 4 free bits, which is more
than it should strictly remove but that's how it is for now.

There are other non-address bit uses like pointer authentication.
To ensure the memory tag manager only has to deal with memory tags,
use the ABI plugin to remove the rest.

The tag access test has been updated to sign all the relevant pointers
and require that we're running on a system with pointer authentication
in addition to memory tagging.

The pointers will look like:
<4 bit user tag><4 bit memory tag><signature><bit virtual address>

Note that there is currently no API for reading memory tags. It will
also have to consider this when it arrives.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D117672
2022-01-20 10:48:14 +00:00