Skip to content

Commit 069bd8f

Browse files
committed
feat(lldb): LLDB data formatters
1 parent 7d27204 commit 069bd8f

File tree

3 files changed

+810
-0
lines changed

3 files changed

+810
-0
lines changed

bootstrap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,7 @@ def generate_pretty_printer_configs(self):
25082508
lldbinit_content += f"# echo 'settings set target.load-cwd-lldbinit true' >> ~/.lldbinit\n"
25092509
lldbinit_content += f"# \n"
25102510
lldbinit_content += f"command script import {os.path.join(self.options.llvm_src_dir, 'llvm', 'utils', 'lldbDataFormatters.py').replace(os.sep, '/')}\n"
2511+
lldbinit_content += f"command script import {os.path.join(self.options.mrdocs_src_dir, 'share', 'lldb', 'mrdocs_formatters.py').replace(os.sep, '/')}\n"
25112512
with open(lldbinit_path, "w") as f:
25122513
f.write(lldbinit_content)
25132514
print(f"Generated LLDB pretty printer configuration at '{lldbinit_path}'")

share/lldb/README.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
= LLDB data formatters
2+
3+
Create or modify your `.lldbinit` file to contain the following:
4+
5+
[source,lldb]
6+
----
7+
command script import /path/share/lldb/mrdocs_formatters.py <1>
8+
type category enable MrDocs <2>
9+
----
10+
11+
<1> Import the LLDB formatter module. LLDB will call `__lldb_init_module` inside `mrdocs_formatters.py` to register summaries and synthetic children.
12+
<2> Ensure the `MrDocs` type category is enabled. (The module already enables it; this line is harmless redundancy.)
13+
14+
This pattern registers the formatters as soon as LLDB imports the module.
15+
16+
== Hot-reload during a session (useful while editing the file)
17+
18+
[source,lldb]
19+
----
20+
script import importlib, mrdocs_formatters; importlib.reload(mrdocs_formatters) <1>
21+
----
22+
23+
<1> Reloads the module without restarting LLDB.
24+

0 commit comments

Comments
 (0)