Commit Graph

165 Commits

Author SHA1 Message Date
Jonas Devlieghere
2ab98dfe19 [lldb] Update link to GreenDragon in the docs 2024-10-29 09:45:29 -07:00
Michael Buch
7b703bd3e7 [lldb][docs] Fix "Developing LLDB" table of contents (#113166)
Currently all the headings marked as `#` show up
as a top-level entry in the `Developing LLDB`
toctree. This patch marks these as `##` so only
`Adding Programming Language Support` is displayed
in the table of contents.
2024-10-21 22:19:26 +01:00
Jonas Devlieghere
6e02e19cd3 [lldb][docs] Add JSON symbol file docs to the ToC 2024-10-18 14:22:54 -07:00
Jonas Devlieghere
7437f3ef7e [lldb] Document SymbolFileJSON (#112938)
I've had multiple request for documentation about the JSON symbol file
format that LLDB supports. This patch documents the structure and
fields, shows a handful of examples and explains how to use it in LLDB.
2024-10-18 13:24:15 -07:00
Vladislav Dzhidzhoev
32e90bbe57 [lldb][test] Support remote run of Shell tests (#95986)
1. This commit adds LLDB_TEST_PLATFORM_URL, LLDB_TEST_SYSROOT,
LLDB_TEST_PLATFORM_WORKING_DIR, LLDB_SHELL_TESTS_DISABLE_REMOTE cmake
flags to pass arguments for cross-compilation and remote running of both Shell&API tests.
2. To run Shell tests remotely, it adds 'platform select' and 'platform connect' commands to %lldb
substitution.
3. 'remote-linux' feature added to lit to disable tests failing with
remote execution.
4. A separate working directory is assigned to each test to avoid
conflicts during parallel test execution.
5. Remote Shell testing is run only when LLDB_TEST_SYSROOT is set for
building test sources. The recommended compiler for that is Clang.

---------

Co-authored-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
2024-10-07 20:31:33 +02:00
Adrian Vogelsgesang
6c137b75f3 [lldb-dap][docs] Improve documentation for contributors (#110987)
This commit extends the developer docs for `lldb-dap`. It also adds a
short "Contributing" section to the user-facing README.

Last but not least, it updates the `repository` in the package.json to
point to the actual source of truth for the source code, instead of
pointing to its mirrored repository. I hope that the VS Code Marketplace
properly supports the `directory` property. Unfortunately, I have no way
to test this before merging this Pull Request.
2024-10-03 19:51:34 +02:00
Dmitry Vasilyev
2e89312419 [lldb] Removed gdbserver ports map from lldb-server (#104238)
Listen to gdbserver-port, accept the connection and run `lldb-server gdbserver --fd` on all platforms.
Parameters --min-gdbserver-port and --max-gdbserver-port are deprecated now.

This is the part 2 of #101283.

Fixes #97537.
2024-10-03 21:00:47 +04:00
David Spickett
a3cf01d585 [lldb][docs] Resurrect the information on adding a new language (#109427)
This got deleted in e078c9507c, I presume
accidentally, because it didn't have a corresponding rst file for it.

So I've brought it back and converted it into Markdown. The content
remains accurate, from what I know at least.

It's a bit "now draw the rest of the owl" but if nothing else, it gives
you a bunch of important classes to go and research as a starting point.

You can see the original content here:
5d71fc5d7b/lldb/www/adding-language-support.html
2024-09-24 11:21:24 +01:00
jimingham
02d8813820 Add a comment in the SB API doc about keeping the SB API's lightweight. (#108462) 2024-09-13 10:18:03 -07:00
David Spickett
77b388cfc6 [lldb][Docs] Fix broken link to qemu testing page 2024-09-06 09:31:19 +01:00
Jason Molenda
2ba1aeed2e [lldb] Don't use a vm addr range starting at 0 for local memory (#100288)
When an inferior stub cannot allocate memory for lldb, and lldb needs to
store the result of expressions, it will do it in lldb's own memory
range ("host memory"). But it needs to find a virtual address range that
is not used in the inferior process. It tries to use the
qMemoryRegionInfo gdb remote serial protocol packet to find a range that
is inaccessible, starting at address 0 and moving up the size of each
region.

If the first region found at address 0 is inaccessible, lldb will use
the address range starting at 0 to mean "read lldb's host memory, not
the process memory", and programs that crash with a null dereference
will have poor behavior.

This patch skips consideration of a memory region that starts at address
0.

I also clarified the documentation of qMemoryRegionInfo to make it clear
that the stub is required to provide permissions for a memory range that
is accessable, it is not an optional key in this response. This issue
was originally found by a stub that did not list permissions in its
response, and lldb treated the first region returned as the one it would
use. (the stub also didn't support the memory-allocate packet)
2024-07-24 17:25:57 -07:00
David Spickett
d4a89af5a8 [lldb][Docs] Move QEMU testing page into the developing lldb section 2024-07-16 13:08:04 +01:00
Aaron Siddhartha Mondal
852aaf5407 Reapply "[Support] Remove terminfo dependency (#92865)" (#93889)
This reverts commit fe82a3da36.

This broke LLDB on MacOS due to a missing symbol during linking.

The fix has been applied in c6c08eee37.

Original commit message:

The terminfo dependency introduces a significant nonhermeticity into the
build. It doesn't respect `--no-undefined-version` meaning that it's not
a dependency that can be built with Clang 17+. This forces maintainers
of source-based distributions to implement patches or ignore linker
errors.

Remove it to reduce the closure size and improve portability of
LLVM-based tools. Users can still use command line arguments to toggle
color support expliticly.

Fixes #75490
Closes #53294 #23355
2024-05-31 01:29:00 +02:00
Michael Buch
fe82a3da36 Revert "[Support] Remove terminfo dependency (#92865)"
This reverts commit 6bf450c7a6.

It breaks LLDB CI: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/4762/execution/node/97/log/

```
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -Wdocumentation -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG -arch arm64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=14.1 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-dead_strip -Wl,-no_warn_duplicate_libraries tools/lldb/unittests/Editline/CMakeFiles/EditlineTests.dir/EditlineTest.cpp.o -o tools/lldb/unittests/Editline/EditlineTests  lib/libLLVMSupport.a  lib/libllvm_gtest_main.a  lib/libllvm_gtest.a  lib/liblldbHost.a  lib/liblldbUtility.a  lib/libLLVMTestingSupport.a  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libxml2.tbd  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libedit.tbd  lib/liblldbHostMacOSXObjCXX.a  lib/liblldbUtility.a  -framework Foundation  -framework CoreFoundation  -framework CoreServices  -framework Security  lib/libLLVMObject.a  lib/libLLVMIRReader.a  lib/libLLVMBitReader.a  lib/libLLVMAsmParser.a  lib/libLLVMCore.a  lib/libLLVMRemarks.a  lib/libLLVMBitstreamReader.a  lib/libLLVMMCParser.a  lib/libLLVMMC.a  lib/libLLVMDebugInfoCodeView.a  lib/libLLVMTextAPI.a  lib/libLLVMBinaryFormat.a  lib/libLLVMTargetParser.a  lib/libllvm_gtest.a  lib/libLLVMSupport.a  -lm  /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd  /opt/homebrew/lib/libzstd.dylib  lib/libLLVMDemangle.a  -lpthread && cd /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/Editline && /opt/homebrew/Cellar/cmake/3.28.3/bin/cmake -E make_directory /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/Editline/./Inputs
ld: Undefined symbols:
  _setupterm, referenced from:
      lldb_private::Editline::Editline(char const*, __sFILE*, __sFILE*, __sFILE*, std::__1::recursive_mutex&) in liblldbHost.a[35](Editline.cpp.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
2024-05-29 16:20:42 +01:00
Aaron Siddhartha Mondal
6bf450c7a6 [Support] Remove terminfo dependency (#92865)
The terminfo dependency introduces a significant nonhermeticity into the
build. It doesn't respect `--no-undefined-version` meaning that it's not
a dependency that can be built with Clang 17+. This forces maintainers
of source-based distributions to implement patches or ignore linker
errors.

Remove it to reduce the closure size and improve portability of
LLVM-based tools. Users can still use command line arguments to toggle
color support expliticly.

Fixes #75490
Closes #53294 #23355
2024-05-24 20:20:15 +02:00
Jonas Devlieghere
525bd66fc2 [lldb-dap] Separate user and developer documentation (#92428)
The README.md is what users see when they look for the extension in the
Marketplace [1]. Right now, it's a mix of developer documentation (for
us) and user documentation. This commit moves the developer docs into
`docs` and the lldb website and refocuses the README on using the
extension.

[1] https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.lldb-dap
2024-05-16 10:41:06 -07:00
David Spickett
b6f050fa12 [lldb] Document some more packets (#92124)
Comparing a bit of the mock GDB server code to what was in the document
I found these:
* QLaunchArch
* qSpeedTest
* qSymbol

qSymbol is the most mysterious but it did have some examples in a
comment so I've adapted that.
2024-05-15 11:20:58 +01:00
David Spickett
0c42fa361d [lldb][Docs] Sort documented packets alphabetically (#90584)
For the platform and extension doc.

Also add links in the extension doc to the GDB specs we're extending.
2024-05-01 08:57:52 +01:00
David Spickett
ff6c0cac70 [lldb][Docs] Remove more subtitles from packets doc (#90443)
This removes various subtitles or converts them to bold text so that the
table of contents is less cluttered.

This includes "Example", "Notes", "Priority To Implement" and
"Response".
2024-04-30 08:14:12 +01:00
David Spickett
41942c852e [lldb[Docs] Reduce title noise in packets doc (#90183)
This removes the "Brief" and "Description" subtitles and merges the text
of both so that the contents listing is clearer.
2024-04-29 08:40:09 +01:00
David Spickett
bd53c7cce4 [lldb][Docs] Document vFile "MD5" and "exists"
This is a Markdown version of https://github.com/llvm/llvm-project/pull/89357.
2024-04-26 09:45:17 +01:00
David Spickett
c4b28bf903 [lldb][Docs] Link from platform doc to extensions doc (#90029)
So we aren't describing the same packets twice. Basically turning the
platform doc into a list of cross links.

qLaunchSuccess was missing a description so I added one.
2024-04-26 09:33:29 +01:00
David Spickett
51f6570eba [lldb][Docs] Convert platform packets doc to Markdown (#89913)
As before, script did most of the work, hand edits after that.

There's a lot more we can do dedupe this and the packets doc, this will
come in a follow up PR.
2024-04-25 08:49:57 +01:00
Chelsea Cassanova
1b54805dfc [lldb][docs] Update instructions for debugging API tests (#89979) 2024-04-24 18:31:31 -07:00
David Spickett
601d0caf3b [lldb][Docs] Convert GDB protocol extensions doc to Markdown and add to website (#89718)
This document has never been on the website, unlike GDB's protocol docs.
It will be useful to have both available online to compare.

Markdown is easier to edit and preview in many editors (including Github
itself), so I've chosen that over RST. Plus, building the website takes
minutes and I lose the will to make nice edits when I have to deal with
that.

The standard dialiect lacks some things notably multi-line table cells,
so I've converted large tables into bullet point lists
so that we still get text wrapping. This is a downside but I think the
simplicity of Markdown outweighs this.

I have applied the plain text markers where I've noticed it and escaped
some HTML characters. There may be more changes needed but, it's
Markdown, so it's in theory a lot easier for someone to fix it!
2024-04-24 09:25:32 +01:00
David Spickett
03e841c870 [lldb] Correct documentation of LLDB_TEST_USER_ARGS (#89042)
https://discourse.llvm.org/t/running-lldb-in-a-container/76801/4 found
that the obvious way to use this variable doesn't work, despite what our
docs and examples say.

Perhaps in the past it did but now you need to use ";" as a separator to
make sure the final command line works properly.

For example "-A foo" becomes "-A foo" when python goes to run the runner
script. The script sees this as one command line element, not two. What
you actually want is "-A;foo" which we convert to "-A" "foo" which the
script sees as one option and one value for that option.

The "Script:" printout from dotest is misleading here because it does `"
".join(cmd)` so it looks like it's ok but in fact it's not.

I'm not changing that format though because printing the command as a
Python list is not useful outside of this specific situation.
2024-04-18 09:08:53 +01:00
Mark de Wever
9a9aa41dea [LLDB][doc] Updates build instructions. (#84630)
Recently building libc++ requires building libunwind too. This updates
the LLDB instructions.

I noticed this recently and it was separately filed as
https://github.com/llvm/llvm-project/issues/84053
2024-03-11 17:45:48 +01:00
David Spickett
e77f5fe889 [lldb][Docs] Add libxml2 to apt install command 2024-03-11 11:41:56 +00:00
David Spickett
235332150d [lldb][Docs] Add Curses version note to build page
This explains a thing that hit me on FreeBSD because the base system
has an ncursesw at one version and I installed from pkg another
version that was simply ncurses (no wide char support).

For whatever reason, when we pass -lcurses to the linker it ends up
picking bits of both installs. This led to lldb crashing immediately
if you tried to use the `gui` command.

In a way that gave little information but I stumbled onto
https://github.com/vifm/vifm/issues/325 which is very similar.

```
ec2-user@freebsd:~/build-llvm $ ldd ./bin/lldb | grep curses
	libncursesw.so.9 => /lib/libncursesw.so.9 (0x6a515206e000)
	libncurses.so.6 => /usr/local/lib/libncurses.so.6 (0x6a5158e86000)
```

We should only see one version, and it and libpanel etc should
all have "w" or not have "w". This was not the case for my build.

What I can see from the CMake side seemed fine, it found the pkg
installed ncurses in /usr/local. Something else must decide that
-lcurses should pull in the other one.

Regardless, I don't know how to fix that but the solution for most
people is just not to add another ncurses if they already have one.
So I've added a note saying so, and how to check what your lldb
is using.
2024-03-08 11:33:17 +00:00
David Spickett
0f8cb6818d [lldb][Docs] Update the build guide
* gmake is needed on FreeBSD
* pkg can install libxml2 on FreeBSD
* Make the swig note into an RST note box.
2024-03-08 10:43:17 +00:00
Jordan Rupprecht
2685e7eadc [lldb][docs] Remove/update docs pointing to unittest2 (#82672) 2024-02-22 13:34:00 -06:00
Po-yao Chang
d70b1c1206 [LLDB][Docs] Replace LLDB_RELOCATABLE_PYTHON with LLDB_EMBED_PYTHON_HOME (#81310)
LLDB_RELOCATABLE_PYTHON was removed in LLVM 11
(3ec3f62f0a).
2024-02-11 09:36:59 +08:00
Chelsea Cassanova
d483abd0fd [lldb][docs] Update reference to test directory location (#71081)
The instructions for running single tests in the LLDB test suite used an
older directory structure from before the LLVM project became a
monorepo. This commit updates the references to these directories.
2023-11-02 10:35:42 -07:00
Aiden Grossman
2f15082b15 [LLDB] Update docs on building documentation (#69858)
This patch updates the documentation to match recent changes and make it
more clear. More specifically, the process for installing sphinx has
changed with the transition to myst with the requirements.txt in
llvm/docs being the preferred method for installation now. In addition,
the docs-lldb-html target is never generated if swig isn't installed, so
having something expliti in the documentation section (even if it is
mentioned as a dependency of lldb itself above) probably doesn't hurt.
2023-10-23 12:59:39 -07:00
David Spickett
70306238cf [lldb][docs] Add strace example to Debugging doc
This has been very useful lately debugging remote
connections. In some cases it's probably better
than our own logging.
2023-10-23 17:04:34 +01:00
David Spickett
cf5639dd2d [lldb][Docs] Fix typo in debugging lldb doc 2023-10-09 08:18:13 +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
David Spickett
87f937e9d6 [lldb][Docs] Fix typo in style docs 2023-09-20 08:04:23 +00:00
David Spickett
ca723f2d40 [lldb][Docs] Document our major differences from the LLVM style (#66345)
Running:
$ clang-format -i $(find -regex "\./lldb/.*\.c") $(find -regex
"\./lldb/.*\.cpp") $(find -regex "\./lldb/.*\.h")

Resulted in:
 1602 files changed, 25090 insertions(+), 25849 deletions(-)
(note: this includes tests which we wouldn't format, just using this as
an example)

The vast majority of which were whitespace changes. So as far as
formatting we're not deviating from llvm for any reason other than not
churning old code.

Formatting aside, the major features of lldb (single line if, early
return) are all reflected in llvm's style. We differ mainly on variable
naming (proposed to change in
https://llvm.org/docs/Proposals/VariableNames.html anyway) and use of
asserts. Which was already documented.
2023-09-19 08:23:00 +01:00
David Spickett
1a8b36b16c [lldb][Docs] Link up the newly restored data formatters page
In the place it used to be linked from.
2023-09-18 13:20:42 +01:00
Jonas Devlieghere
c60ccfbb89 [lldb] Revive internal data formatter documentation (#66527)
This is a (rough) port of architecture/varformats.html page that got
lost during the migration to RST in edb874b. I'm not sure how much of
its content is still relevant today. However, the page is pretty
extensive and seems like it's worth preserving.
2023-09-15 11:15:13 -07:00
David Spickett
1d75d42689 [lldb][Docs] Update links in Data Formatter section (#66474)
Neither actually linked anywhere, but I did find a good target for the
introduction.

For the architecture side I don't see a page that would fit, so I've
just removed the sentence.
2023-09-15 16:39:49 +01:00
David Spickett
3ae76e4fdc [lldb][Docs] Link to testing page from debugging page
The testing page already has some page about debugging failures.

I'm not linking directly to that section because:
* The earlier sections about running single tests and such
  are just as useful for debugging in general.
* The new theme has a nice sidebar on the right that makes
  it really easy to find what you want once on the page.
* We'll probably add more content to the testing page later.
2023-09-14 11:16:33 +01:00
David Spickett
f8b2544c42 [lldb] Link to LLVM code style in LLDB's contributing page
So folks at least know what we are differing from.
2023-09-13 10:48:48 +01:00
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