94 Commits

Author SHA1 Message Date
Jason Molenda
a3fe9221ab
Remove hardware index from watchpoints and breakpoints (#72012)
The Watchpoint and Breakpoint objects try to track the hardware index
that was used for them, if they are hardware wp/bp's. The majority of
our debugging goes over the gdb remote serial protocol, and when we set
the watchpoint/breakpoint, there is no (standard) way for the remote
stub to communicate to lldb which hardware index was used. We have an
lldb-extension packet to query the total number of watchpoint registers.

When a watchpoint is hit, there is an lldb extension to the stop reply
packet (documented in lldb-gdb-remote.txt) to describe the watchpoint
including its actual hardware index,

<addr within wp range> <wp hw index> <actual accessed address>

(the third field is specifically needed for MIPS). At this point, if the
stub reported these three fields (the stub is only required to provide
the first), we can know the actual hardware index for this watchpoint.

Breakpoints are worse; there's never any way for us to be notified about
which hardware index was used. Breakpoints got this as a side effect of
inherting from StoppointSite with Watchpoints.

We expose the watchpoint hardware index through "watchpoint list -v" and
through SBWatchpoint::GetHardwareIndex.

With my large watchpoint support, there is no *single* hardware index
that may be used for a watchpoint, it may need multiple resources. Also
I don't see what a user is supposed to do with this information, or an
IDE. Knowing the total number of watchpoint registers on the target, and
knowing how many Watchpoint Resources are currently in use, is helpful.
Knowing how many Watchpoint Resources
a single user-specified watchpoint needed to be implemented is useful.
But knowing which registers were used is an implementation detail and
not available until we hit the watchpoint when using gdb remote serial
protocol.

So given all that, I'm removing watchpoint hardware index numbers. I'm
changing the SB API to always return -1.
2023-11-15 13:32:42 -08:00
David Spickett
d3fb05ba10
[lldb][AArch64][Linux] Add SME2 release notes and usage docs (#70935)
ZT0 is much like ZA apart from not being scalable, so there's not much
new to cover.
2023-11-08 09:23:02 +00:00
David Spickett
42c25fddcb [lldb][docs][AArch64] Update example in SME docs
This output has now changed because I moved the za register
into the main SME register set.
2023-10-25 13:12:37 +00:00
David Spickett
bb826951dc
[lldb][AArch64] Add release notes and documentation for SME (#66767)
This adds a release note for all the SME support now in LLDB and a page
where I have documented the user experience (for want of a better term)
when using SVE and SME.

This includes things like which mode transitions can or cannot be
triggered from within LLDB. I hope this will serve to A: document what
I've implemented and B: be a user's guide to these extensions.

(though it is not a design document, read the commits and code for that
sort of detail)
2023-10-20 14:06:06 +01:00
David Spickett
f47914a7cd [lldb][Docs] Use RST link format in IntelPT doc 2023-10-09 08:21:21 +01:00
David Spickett
21030b9ab4 [lldb][Docs] Add section on using QEMU without bridge networking
Bridge network means that you can get to any port on the VM,
from the host, which is great. However it is quite involved to
setup in some cases, and I've certainly messed it up in the past.

An alternative is forwarding a block of ports and using some
hidden options to lldb-server to limit what it uses. This
commit documents that and the pitfall that the port list isn't shared.

The theory also works for Arm's FVP (which inspired me to write
this up) but since QEMU is the preferred option upstream, it goes
in that document.

Along the way I fixed a link to the QEMU page that used the URL
not a relative link to the document.
2023-10-06 15:28:10 +01:00
Author: Eddie Phillips
9ce82a10a3 Wrong link target in the documentation #62990
In the LDDB documentation you have the following sentence:

"The --format (which you can shorten to -f) option accepts a format name."

The link points to the wrong place.

I pointed it to the table that precedes the Type summary section.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D151668
2023-09-08 15:38:28 +01:00
Jonas Devlieghere
3aa678a777
[lldb/docs] Add section links to the top of the GDB to LLDB command map
Add section links to the top of the GDB to LLDB command map. This makes
navigating the page easier.
2023-09-07 16:26:53 -07:00
Kazu Hirata
5dd9568717 Fix typos in documentation 2023-09-02 09:32:48 -07:00
Med Ismail Bennani
6a2552a141 [lldb/infra] Revamp lldb.llvm.org
This patch brings a fresh coat of paint to the LLDB website.

This uses the `furo` theme from the suggested theme list, adds some
changes to the css to make it use the full browser window width and
removes the table of contents since the theme generates it automatically.

This patch also rewrites the tables for "GDB to LLDB command map" to
convert them from raw HTML to native inlined code blocks.

To generate the website, make sure you install the theme first with
`pip install furo`, enable sphinx in the cmake invocation` then run
`ninja docs-lldb-html`

Discourse: https://discourse.llvm.org/t/rfc-revamping-lldbs-website

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-08-26 09:54:56 +01:00
Med Ismail Bennani
dfb48dcc9c Revert "[lldb/infra] Revamp lldb.llvm.org"
This patch reverts the lldb website revamp (eea8874) since the `furo` theme
that we use is not installed on the publisher bot. The prevents other
website from getting there documentation updated.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-08-24 19:44:16 +01:00
Med Ismail Bennani
eea8874064 [lldb/infra] Revamp lldb.llvm.org
This patch brings a fresh coat of paint to the LLDB website.

This uses the `furo` theme from the suggested theme list, adds some
changes to the css to make it use the full browser window width and
removes the table of contents since the theme generates it automatically.

This patch also rewrites the tables for "GDB to LLDB command map" to
convert them from raw HTML to native inlined code blocks.

To generate the website, make sure you install the theme first with
`pip install furo`, enable sphinx in the cmake invocation` then run
`ninja docs-lldb-html`

Discourse: https://discourse.llvm.org/t/rfc-revamping-lldbs-website

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-08-24 15:41:16 +01:00
Jonas Devlieghere
3e3880e370
[lldb] Simplify the LLDB website structure
Feedback I hear regularly is that the LLDB website is hard to navigate.
This patch is an attempt to simplify things by breaking the website up
in 3 major areas: "Using LLDB", "Scripting LLDB" and "Developing LLDB".

  - The majority of the "project" pages were eliminated. The projects
    page was moved under "Developing LLDB". The releases page was
    replaced with a link under "External links". The other pages (goals,
    features and status) were pretty outdated and while they probably
    made sense in the past, they don't feel all that relevant anymore
    now that LLDB is an established debugger.

  - "USE & EXTENSION" was renamed to "Using LLDB". Besides that, this
    section remained mostly unchanged. The exception are the Python
    pages which were moved under "Scripting LLDB".

  - "Development" was renamed to "Developing LLDB" and now houses all the
    resources for LLDB developers. The old "Design" section (which only
    contained two pages) was moved back under here too.

Differential revision: https://reviews.llvm.org/D158023
2023-08-18 11:20:20 -07:00
David Spickett
01e30b30d0 [lldb][AArch64] Add Scalable Matrix Extension option to QEMU launch script
The Scalable Matrix Extension (SME) does not require extra options
beyond setting the cpu to "max".

https://qemu-project.gitlab.io/qemu/system/arm/cpu-features.html#sme-cpu-property-examples

SME depends on SVE, so that will be enabled too even if you don't ask
for it by name.

--sve --sme -> SVE and SME
--sme       -> SVE and SME
--sve       -> Only SVE

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D152519
2023-06-14 14:33:47 +01:00
Kazu Hirata
23e26cb98d [lldb] Fix typos in documentation 2023-05-23 22:10:59 -07:00
Jim Ingham
d98086036a Add usage info for backtick to the lldb tutorial. 2023-02-02 13:47:12 -08:00
Saagar Jha
93ccccb00d
[lldb] Fix typos and update "GDB To LLDB Command Map" to be a bit more clear
I've gone through the GDB To LLDB Command Map and tried to improve it:

 - Fix obvious typos (e.g. <cope> → <code>)
 - Wrap code and program names in <code> tags
 - Reword a couple parts where (IMHO) the phrasing could be a bit better

Differential revision: https://reviews.llvm.org/D28758
2023-01-15 11:10:52 -08:00
Jorge Gorbe Moya
868186cf6c [lldb] Make callback-based formatter matching available from the CLI.
This change adds a `--recognizer-function` (`-R`) to `type summary add`
and `type synth add` that allows users to specify that the names in
the command are not type names but python function names.

It also adds an example to lldb/examples, and a section in the data
formatters documentation on how to use recognizer functions.

Differential Revision: https://reviews.llvm.org/D137000
2022-11-10 10:29:38 -08:00
Michael Buch
2a812bdc70 [lldb][Docs][NFC] Fix sphinx warnings/errors for LLDB docs
Ran `ninja docs-lldb-html` and made sure the docs are fixed.

Differential Revision: https://reviews.llvm.org/D136766
2022-10-28 11:31:15 +01:00
David Spickett
6cc5bcc12d [LLDB] Correct env vars for Android port selection
These should have "LOCAL" in them.

First added in 1e210abf9925ad08fb7c79894b4ec5ef8f0ef173.
2022-10-26 12:31:27 +00:00
Luka Markušić
1e210abf99 [LLDB] Make remote-android local ports configurable
The local ports for `platform connect` and `attach` were always random, this allows the user to configure them.
This is useful for debugging a truly remote android (when the android in question is connected to a remote server).

There is a lengthier discussion on github - https://github.com/llvm/llvm-project/issues/58114

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D136465
2022-10-26 08:14:22 +00:00
Michael Buch
891eb20104 [LLDB][Docs][NFC] Fix formatting in -gmodules documentation 2022-10-25 12:34:00 +01:00
David Spickett
3d9bf8ce7b [LLDB] Add missing breaks to current frame row in command map
Without these it was rendering as one line for all three commands.
2022-10-25 10:20:07 +00:00
David Spickett
68ab7accc7 [LLDB] Add "frame select" as equivalent of GDB's "frame" command
This is useful for answering the question "where am I?" and is surprisingly
difficult to figure out without just doing another step command.

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D134873
2022-10-07 09:30:05 +00: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
Adrian Prantl
1f47352ce7 Document some of the clang-specific DWARF extensions supported by LLDB
This patch adds a new page to the LLDB documentation that documents,
among other things the -gmodules debug info format.

Differential Revision: https://reviews.llvm.org/D133519
2022-09-09 17:49:11 -07:00
Jim Ingham
edea4a349d You can't use lldb.target in a frame recognizer. 2022-09-06 13:20:48 -07:00
Dave Lee
87990fd8f4 [lldb] Fix formatting in python-reference.rst 2022-08-07 12:17:36 -06:00
Walter Erquinigo
6a5355e8a1 [trace][intelpt] Support system-wide tracing [20] - Rename some fields in the schema
As discusses offline with @jj10305, we are updating some naming used throughout the code, specially in the json schema

- traceBuffer -> iptTrace
- core -> cpu

Differential Revision: https://reviews.llvm.org/D127817
2022-06-16 11:42:22 -07:00
Walter Erquinigo
fc5ef57c7d [trace][intelpt] Support system-wide tracing [12] - Support multi-core trace load and save
:q!
This diff is massive, but it's because it connects the client with lldb-server
and also ensures that the postmortem case works.

- Flatten the postmortem trace schema. The reason is that the schema has become quite complex due to the new multicore case, which defeats the original purpose of having a schema that could work for every trace plug-in. At this point, it's better that each trace plug-in defines it's own full schema. This means that the only common field is "type".
-- Because of this new approach, I merged the "common" trace load and saving functionalities into the IntelPT one. This simplified the code quite a bit. If we eventually implement another trace plug-in, we can see then what we could reuse.
-- The new schema, which is flattened, has now better comments and is parsed better. A change I did was to disallow hex addresses, because they are a bit error prone. I'm asking now to print the address in decimal.
-- Renamed "intel" to "GenuineIntel" in the schema because that's what you see in /proc/cpuinfo.
- Implemented reading the context switch trace data buffer. I had to do
some refactors to do that cleanly.
-- A major change that I did here was to simplify the perf_event circular buffer reading logic. It was too complex. Maybe the original Intel author had something different in mind.
- Implemented all the necessary bits to read trace.json files with per-core data.
- Implemented all the necessary bits to save to disk per-core trace session.
- Added a test that ensures that parsing and saving to disk works.

Differential Revision: https://reviews.llvm.org/D126015
2022-06-15 13:28:36 -07:00
Adrian Prantl
d36757b511 [LLDB][Docs] Fix formatting of example code-block
Tested by building the docs-lldb-html target and
confirming the code-block renders properly with
the fix.

Patch by Michael Buch!

Differential Revision: https://reviews.llvm.org/D127437
2022-06-10 08:17:08 -07:00
Jonas Devlieghere
5a1062055e
[lldb] Fix code blocks in docs/use/intel_pt.rst 2022-06-09 09:14:56 -07:00
Jim Ingham
aa7470a1b3 Add a paragraph showing how to use container commands.
Differential Revision: https://reviews.llvm.org/D124028
2022-04-29 11:11:52 -07:00
Jeffrey Tan
7b81192d46 Introduce new symbol on-demand for debug info
This diff introduces a new symbol on-demand which skips
loading a module's debug info unless explicitly asked on
demand. This provides significant performance improvement
for application with dynamic linking mode which has large
number of modules.
The feature can be turned on with:
"settings set symbols.load-on-demand true"

The feature works by creating a new SymbolFileOnDemand class for
each module which wraps the actual SymbolFIle subclass as member
variable. By default, most virtual methods on SymbolFileOnDemand are
skipped so that it looks like there is no debug info for that module.
But once the module's debug info is explicitly requested to
be enabled (in the conditions mentioned below) SymbolFileOnDemand
will allow all methods to pass through and forward to the actual SymbolFile
which would hydrate module's debug info on-demand.

In an internal benchmark, we are seeing more than 95% improvement
for a 3000 modules application.

Currently we are providing several ways to on demand hydrate
a module's debug info:
* Source line breakpoint: matching in supported files
* Stack trace: resolving symbol context for an address
* Symbolic breakpoint: symbol table match guided promotion
* Global variable: symbol table match guided promotion

In all above situations the module's debug info will be on-demand
parsed and indexed.

Some follow-ups for this feature:
* Add a command that allows users to load debug info explicitly while using a
  new or existing command when this feature is enabled
* Add settings for "never load any of these executables in Symbols On Demand"
  that takes a list of globs
* Add settings for "always load the the debug info for executables in Symbols
  On Demand" that takes a list of globs
* Add a new column in "image list" that shows up by default when Symbols On
  Demand is enable to show the status for each shlib like "not enabled for
  this", "debug info off" and "debug info on" (with a single character to
  short string, not the ones I just typed)

Differential Revision: https://reviews.llvm.org/D121631
2022-04-26 10:42:06 -07:00
Alisamar Husain
84caf73c52 [lldb/docs] Fixed minor ugly links 2022-03-23 13:00:18 +05:30
Walter Erquinigo
360dcb759d [simple] fix some the documentation
Some links were not rendered correctly in the intel pt documentation and
some spacing was fixed in some command objects.
2022-03-22 09:10:42 -07:00
Walter Erquinigo
15c2d9cd79 [simple] fix formatting in the intel-pt doc
A list needs to be properly formatted.
2022-03-21 15:56:55 -07:00
Alisamar Husain
1bcc28b884 [docs] Fixed minor ordering issue
Differential Revision: https://reviews.llvm.org/D122073
2022-03-19 22:23:42 +05:30
Alisamar Husain
752e9cdbb0 [trace][intelpt][docs] Added intel-pt build instructions for lldb
Differential Revision: https://reviews.llvm.org/D121935
2022-03-19 15:26:59 +05:30
Med Ismail Bennani
258cd02c6a [lldb/doc] Rephrase tutorial paragraph (NFC)
Fixes #52694

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-14 16:23:26 -08:00
Dave Lee
1441ffe6a6 [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom
Update examples and docs to demonstrate using `__lldb_init_module` instead of
the idiom that checks for `lldb.debugger` at the top-level.

```
if __name__ == '__main__':
    ...
elif lldb.debugger:
    ...
```

Is replaced with:

```
if __name__ == '__main__':
    ...

def __lldb_init_module(debugger, internal_dict):
    ...
```

This change is for two reasons. First, it's generally encouraged not to only
use the convenience singletons (`lldb.{debugger,process,target,etc}`)
interactively from the `script` command. Second, there's a bug where
registering a python class as a command (using `command script add -c ...`),
result in the command not being runnable. Note that registering function-backed
commands does not have this bug.

Differential Revision: https://reviews.llvm.org/D117237
2022-01-13 16:37:49 -08:00
Dave Lee
a6f1d04665 [lldb][docs] Update references to SVN 2022-01-09 13:21:40 -08:00
Walter Erquinigo
69c8e64ba6 [formatters] Improve documentation
This adds some important remarks to the data formatter documentation.

Differential Revision: https://reviews.llvm.org/D115974
2022-01-07 16:27:03 -08:00
Shao-Ce SUN
0c660256eb [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
Quinn Pham
04cbfa950e [lldb][NFC] Inclusive Language: rename master plan to controlling plan
[NFC] As part of using inclusive language within the llvm project, this patch
renames master plan to controlling plan in lldb.

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D113019
2021-11-11 15:04:44 -06:00
Shivam Gupta
59c954f76a [LLDB][Docs] Indicate PS1 variable by $ 2021-09-04 20:57:59 +05:30
Shivam Gupta
3af9847a95 [LLDB][Docs] Convert some .txt files to .rst
Upadate some .txt files to .rst for consistency as most
of the documentation is written in reStructuredText format.

Signed-off-by: Shivam Gupta <shivam98.tkg@gmail.com>

Differential Revision: https://reviews.llvm.org/D108807
2021-08-31 11:45:24 +05:30
Christopher Di Bella
c874dd5362 [llvm][clang][NFC] updates inline licence info
Some files still contained the old University of Illinois Open Source
Licence header. This patch replaces that with the Apache 2 with LLVM
Exception licence.

Differential Revision: https://reviews.llvm.org/D107528
2021-08-11 02:48:53 +00:00
Raphael Isemann
51ab17b91d [lldb][docs] Fix reference warnings in python-reference.rst
References with a single '`' around them are interpreted as references instead
of text with monospaced font since the introduction of the new Python API
generator. This meant that all the single-quoted code in this document that
doesn't reference any Python class was throwing sphinx errors. This just adds
the neede extra ` around this code and fixed up the legitimate typos
(e.g. `SBframe` -> `SBFrame`).
2021-07-06 10:14:33 +02:00
Bruce Mitchener
36597e4719 [lldb] Fix typos. NFC.
Differential Revision: https://reviews.llvm.org/D103381
2021-05-31 06:48:57 +07:00