121 Commits

Author SHA1 Message Date
David Spickett
3398744a61
[lldb][Docs] Additions to debuging LLDB page (#65635)
Adds the following:
* A note that you can use attaching to debug the right lldb-server
process, though there are drawbacks.
* A section on debugging the remote protocol.
* Reducing bugs, including reducing ptrace bugs to remove the need for
LLDB.

I've added a standlone ptrace program to the examples folder because:
* There's no better place to put it.
* Adding it to the page seems like wasting space, and would be harder to
update.
* I link to Eli Bendersky's classic blog on the subject, but we are
safer with our own example as well.
* Eli's example is for 32 bit Intel, AArch64 is more common these days.
* It's easier to show the software breakpoint steps in code than explain
it (though I still do that in the text).
* It was living on my laptop not helping anyone so I think it's good to
have it upstream for others, including future me.
2023-09-08 10:05:16 +01:00
David Spickett
ad2453a2db
[lldb][Docs] Add page about debugging lldb itself (#65332)
We have docs about how to use lldb on other programs, this tells you how
to use lldb on ldlb and lldb-server.

Lacking any Mac experience I've not included any debugserver information
apart from stating it will be similar but not the same.

I plan for this page to include sections on debugging tests and other
things but this initial commit is purely about the two main binaries
involved.
2023-09-06 16:22:28 +01:00
David Spickett
6c3232b515
[lldb][Docs] Add simpler "automatic" cross-compile option to build docs (#65311)
The main way I cross build lldb is to point CMake at an existing host
build to get the native tablegen tools. This is what we had documented
before.

There is another option where you start from scratch and the host tools
are built for you. This patch documents that and explains which one to
choose.

Added another arm64 example which uses this. So the frst one is the
"automatic" build and the second is the traditional approach.

For ease of copy paste and understanding, I've kept the full command in
each section and noted the one difference between them.

Along the way I updated some of the preamble to explain the two
approaches and updated some language e.g. removing "just ...". Eveyone's
"just" is different, doubly so when cross-compiling.
2023-09-06 08:48:19 +01: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
David Spickett
1083ae2347 [LLDB][Docs] Update cross compilation docs and examples
To address https://github.com/llvm/llvm-project/issues/64616, this change
does the following:

* Links back to the "Optional Dependencies" section from the cross
  compilation instructions where we talk about removing libraries.
  In the reported issue, the host libXML was found by CMAke somehow and
  disabling libXML fixed it, so this link should encourage users
  to try as many of those options as needed.

* Removes the use of CMAKE_CROSS_COMPILING. In older CMake versions
  it seems you could set this manually but now the advice is to set
  CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR then let CMake figure
  it out.

  There is also CMAKE_SYSTEM_VERSION which the docs say you have to
  set too, but I can only find examples of Windows and Android builds
  using this. It might be needed to "cross" compile from one version
  of AArch64 Linux to another, but I can't confirm that.

* Removes the tablegen tools paths in favour of DLLVM_NATIVE_TOOL_DIR.
  This one setting deals with all build tools in llvm that must be host
  versions.

* Updates the explanations of the common options and orders them
  in some rough order of relevance with the "might be needed" later.

Reviewed By: JDevlieghere, bulbazord

Differential Revision: https://reviews.llvm.org/D158085
2023-08-22 15:53:47 +01:00
Jonas Devlieghere
b6e148f02c
[lldb] Shorten "DWARF Extensions supported by LLDB" in the docs
Shorten "DWARF Extensions supported by LLDB" to just "DWARF Extension".
2023-08-18 15:48:19 -07:00
Jonas Devlieghere
cf6d16f9b5
[lldb] Rename "Projects" to "Open Projects" in the docs
Make it more obvious that these are project ideas rather than say
ongoing projects.
2023-08-18 14:18:21 -07:00
Jonas Devlieghere
12db5c29e1
[lldb] Move Continuous Integration documentation under Testing
The current "Continuous Integration" is pretty scarce. All we really
need is a link to buildbot and GreenDragon. Move this under testing.
2023-08-18 14:05:38 -07: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
Jonas Devlieghere
e0053bc04e
[lldb] Bump SWIG minimum version to 4
SWIG 4 was released in 2019 and has been the de-facto standard for a
while now. All bots are running SWIG 4.0 or later.

This was motivated by #64279 which discovered that 662548c broke the
LLDB build with SWIG 3 on Windows.

Differential revision: https://reviews.llvm.org/D156804
2023-08-04 14:34:01 -07:00
Kazu Hirata
23e26cb98d [lldb] Fix typos in documentation 2023-05-23 22:10:59 -07:00
Jonas Devlieghere
10a50762ca
[lldb] Define lldbassert based on NDEBUG instead of LLDB_CONFIGURATION_DEBUG
Whether assertions are enabled or not is orthogonal to the build type
which could lead to surprising behavior for lldbassert. Previously, when
doing a debug build with assertions disabled, lldbassert would become a
NOOP, rather than printing an error like it does in a release build. By
definining lldbassert in terms of NDEBUG, it behaves like a regular
assert when assertions are enabled, and like a soft assert.

Differential revision: https://reviews.llvm.org/D150639
2023-05-16 09:27:09 -07:00
Jonas Devlieghere
9adf60fc53
[lldb] Fix lldb_assert -> lldbassert in docs
Update the documentation to reference lldbassert rather than
lldb_assert. The latter is the implementation, which shouldn't be used
directly. Instead, users should use lldbassert which is the macro that
expands to assert or lldb_assert depending on the build type.
2023-05-15 22:18:08 -07:00
David Spickett
c912c0eef3 [LLDB][docs] Remove outdated list of Buildbots
This was out of date and the link to the lldb tag will always be up to date.
2023-04-13 08:53:06 +00:00
David Spickett
3fa023970d [lldb] Add lldb-server targets to build docs
The current doc has people just do "ninja lldb" which is
not incorrect, it does build lldb. However it does not build lldb-server.
So you can't just "lldb some-binary" and expect it to work.

I've updated the instructions to reflect that most of the time
you'll want both lldb and lldb-server.

Though there is a use case for building just lldb. I'm assuming
Mac OS (where you have debugserver) and if you only wanted to do
remote debug.

Fixes #59575

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D140385
2023-01-12 12:34:58 +00:00
Kazu Hirata
2fe8327406 [lldb] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<.  I'll post
a separate patch to clean up the "using" declarations, #include
"llvm/ADT/Optional.h", etc.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-07 14:18:35 -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
Michael Buch
12502ee551 [lldb][test] 1 - Don't do test-replication for gmodules debug_info variant
Currently, by default LLDB runs an API test with 3 variants,
one of which, depending on platform, is `gmodules`. However,
most tests don't actually make use of any specific `gmodules`
feature since they compile a single `main.cpp` file without
imporint types from other modules.

Instead of running all tests an extra time with `-gmodules`
enabled, we plan to test `gmodules` features with dedicated
API tests that explicitly opt-into compiling with `-gmodules`.
One of the main benefits of this will be a reduction in total
API test-suite run-time (by around 1/3).

This patch adds a flag to `debug_info_categories` that indicates
whether a category is eligible to be replicated by `lldbtest`.

Keeping `gmodules` a debug-info category is desirable because
`builder.py` knows how to inject the appropriate Makefile flags
into the build command for debug-info categories already. Whereas
for non-debug-info categories we'd have to teach it how to. The
category is inferred from the test-name debug-info suffix currently.

Differential Revision: https://reviews.llvm.org/D134524
2022-09-26 19:54:24 +01:00
Chelsea Cassanova
53f1cc85e3 [lldb][docs] Fix formatting in fuzzing doc
The page for fuzzing LLDB had incorrectly formatted code,
this commit fixes that.

Differential revision: https://reviews.llvm.org/D132775
2022-08-26 22:15:38 -05:00
Chelsea Cassanova
43d7320e71 [lldb][docs] Add documentation for LLDB fuzzers
This commit adds a new page to the LLDB HTML documentation for the LLDB
fuzzers. The page primarily explains what the fuzzers are as well as how
to build them, run them and investigate and reproduce bugs.

Differential revision: https://reviews.llvm.org/D132148
2022-08-26 18:35:21 -05:00
Jonas Devlieghere
0f821339da
[lldb] Add assertStopReason helper function
Add a function to make it easier to debug a test failure caused by an
unexpected stop reason. This is similar to the assertState helper that
was added in ce825e46743b.

Before:

  self.assertEqual(stop_reason, lldb.eStopReasonInstrumentation)
  AssertionError: 5 != 10

After:

  self.assertStopReason(stop_reason, lldb.eStopReasonInstrumentation)
  AssertionError: signal (5) != instrumentation (10)

Differential revision: https://reviews.llvm.org/D131083
2022-08-03 11:44:13 -07:00
Jonas Devlieghere
663612dfd8
[lldb] Remove references to epydoc from the documentation
We no longer rely on epydoc but instead use a sphinx plugin to generate
the Python API reference.
2022-06-16 15:17:40 -07:00
Jonas Devlieghere
6565580f1b
[lldb] Add table with custom LLDB asserts to the docs
Add table with custom LLDB asserts to the documentation.

Differential revision: https://reviews.llvm.org/D127410
2022-06-09 09:14:56 -07:00
Pavel Labath
c7fc7205bb [lldb] Add more documentation on test variants
This formalizes some of the discussion on D121631.

Differential Revision: https://reviews.llvm.org/D121900
2022-03-18 08:58:29 +01:00
Jonas Devlieghere
ef0de5dce7
[lldb] Update the CI docs
Remove the reproducer bot and the fedora bot.
2022-03-02 22:40:05 -08:00
Simon Pilgrim
058c5dfc78 Raise the minimum Visual Studio version to VS2019
As raised here: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153881.html

Now that VS2022 is on general release, LLVM is expected to build on VS2017, VS2019 and VS2022, which is proving hazardous to maintain due to changes in behaviour including preprocessor and constexpr changes. Plus of the few developers that work with VS, many have already moved to VS2019/22.

This patch proposes to raise the minimum supported version to VS2019 (16.x) - I've made the hard limit 16.0 or later, with the soft limit VS2019 16.7 - older versions of VS2019 are "allowed" (at your own risk) via the LLVM_FORCE_USE_OLD_TOOLCHAIN cmake flag.

Differential Revision: https://reviews.llvm.org/D114639
2022-01-29 10:56:41 +00:00
Stella Stamenova
738d73fbf4 [lldb] Update the lldb build instructions on Windows
The existing instructions for lldb on Windows can be more explicit. This adds a few details on how to install various components and the easiest way to get to a working build.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D118425
2022-01-28 10:18:19 -08:00
Tor Arne Vestbø
427f6e11e6 [lldb][docs] Update instructions for building libc++
Reviewed By: sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D115877
2021-12-16 16:50:42 +01:00
Shao-Ce SUN
0c660256eb [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
Shivam Gupta
59c954f76a [LLDB][Docs] Indicate PS1 variable by $ 2021-09-04 20:57:59 +05:30
Shivam Gupta
654e8d6c31 [LLDB][Docs] Move best-practices.txt contain to resources/test.rst
This file contain some old reference to files those are now either renamed or replaced.
Also this .txt file didn't generate to html during the sphnix documentation build so I send its contents to resources/test.rst file.

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

Reviewed By: teemperor, mgorny, JDevlieghere

Differential Revision: https://reviews.llvm.org/D108812
2021-08-31 11:45:24 +05:30
Bruce Mitchener
f7d931ac37 [lldb][docs] Remove mention of subversion. NFC.
Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D103744
2021-07-14 11:04:07 +00:00
Bruce Mitchener
36597e4719 [lldb] Fix typos. NFC.
Differential Revision: https://reviews.llvm.org/D103381
2021-05-31 06:48:57 +07:00
Raphael Isemann
4112f5ef69 [lldb][NFC] Specify guidelines for API tests
This patch specifies a few guidelines that our API tests should follow.

The motivations for this are twofold:

1. API tests have unexpected pitfalls that especially new contributors run into
when writing tests. To prevent the frustration of letting people figure those
pitfalls out by trial-and-error, let's just document them briefly in one place.

2. It prevents some arguing about what is the right way to write tests. I really
like to have fast and reliable API test suite, but I also don't want to be the
bogeyman that has to insist in every review that the test should be rewritten to
not launch a process for no good reason. It's much easier to just point to a
policy document.

I omitted some guidelines that I think could be controversial (e.g., the whole
"should assert message describe failure or success").

Reviewed By: shafik

Differential Revision: https://reviews.llvm.org/D101153
2021-05-17 11:01:47 +02:00
Raphael Isemann
f3e6f856c2 [lldb][NFC] Remove a stray unicode character in the LLDB test docs
There was a U+2028 character in this line (a special paragraph separator).
2021-04-23 13:20:10 +02:00
Dave Lee
0c653d4c3d [lldb] Update test.rst with a paragraph about pdb
Debugging tests sometimes involves debugging the Python source. This adds a paragraph to
the "Debugging Test Failures" section about using `pdb`, and also describes how to run
lldb commands from pdb.

Differential Revision: https://reviews.llvm.org/D99744
2021-04-01 09:53:07 -07:00
Jan Kratochvil
a233d72f0e [lldb/Docs] Update docs with new buildbot URLs 2021-03-17 20:09:03 +01:00
Kazu Hirata
4fd3347d6e [lldb] Fix typos in documentation (NFC) 2021-03-01 23:40:29 -08:00
xgupta
94fac81fcc [Branch-Rename] Fix some links
According to the [[ https://foundation.llvm.org/docs/branch-rename/ | status of branch rename ]], the master branch of the LLVM repository is removed on 28 Jan 2021.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D95766
2021-02-01 16:43:21 +05:30
Raphael Isemann
6e75ee6b65 [lldb][docs] Use inline literals for code/paths instead of rendering it with the default role
Right now we're using the 'content' role as default which will just render
these things as cursive (which isn't really useful for code examples). It also
prevents us from assigning a more useful default role in the future.
2021-01-18 11:10:19 +01:00
Jonas Devlieghere
cb6d53ccdc [lldb] Bump the required SWIG version to 3
Bump the required SWIG version to 3. If my memory serves me well we last
bumped the required SWIG version to 2 for Python 3. At that time SWIG 3
had already been around for a while so everyone I know was already using
that.

It appears that SWIG 3 is the only version that officially supports
C++11 which we're using in the typemap. SWIG 3 was released in 2014 so I
think it's reasonable to make that the minimum required version.

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

Differential revision: https://reviews.llvm.org/D94244
2021-01-08 08:47:21 -08:00
serge-sans-paille
5e31e226b5 Remove Python2 fallback and only advertise Python3 in the doc
Differential Revision: https://www.youtube.com/watch?v=RsL0cipURA0
2020-12-17 15:40:16 +01:00
Jan Kratochvil
b9f0713f73 [lldb/Docs] Fix lldb-x86_64-fedora URL as it is still a silent bot 2020-12-10 13:52:10 +01:00
Jonas Devlieghere
5d501096ca [lldb] Update docs with new buildbot URLs
Buildbot got upgraded and now the (LLDB) builders have different URLs.
2020-10-09 10:57:39 -07:00
Pavel Labath
029290f1a6 [lldb/docs] Clarify python/swig version incompatibility
The problematic combo is a debug python>=3.7 && swig<4.0.

Differential Revision: https://reviews.llvm.org/D88906
2020-10-07 15:29:29 +02:00
Muhammad Omair Javaid
3dffec03b0 [LLDB] Add QEMU testing environment setup guide for SVE testing
This patch adds a HowTo document to lldb docs which gives instruction for
setting up a virtual environment based on QEMU emulator for LLDB testing.

Instruction in this document are tested on Arm and AArch64 targets but
can easily be duplicated for other targets supported by QEMU.

This helps test LLDB in absence for modern AArch64 features not released
in publicly available hardware till date.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D82064
2020-10-06 12:35:08 +05:00
Jonas Devlieghere
128e999d63 [lldb] Add a "design" section to the documentation.
Create a "Design" section for the LLDB documentation. The goal is to
have design documents that describe how the LLDB internals work.

Currently similar pages  are mixed together under the "Development". The
existing pages describing the architecture, the reproducers, the
structured data plugins, and the SB API could be housed here. I hope
we'd see more pages being added here in the future.

Differential revision: https://reviews.llvm.org/D88516
2020-10-02 13:07:31 -07:00
Dave Lee
5d19eb542d [lldb/docs] Remove manual codesigning documentation
The `macos-setup-codesign.sh` script has been in place for over two years. If there are no known issues, it's a good time to drop the manual steps from the docs.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D88257
2020-09-29 12:50:45 -07:00