Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLDB] Add draft docstrings for SBSaveCoreOptions #123132

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

Jlalond
Copy link
Contributor

@Jlalond Jlalond commented Jan 15, 2025

SBSaveCoreOptions has been around for awhile now, so I decided to draft up some Docstrings describing the functionality better. Some of my wording sounded a bit clunky due the optionality of each method call so I would greatly appreciate feedback.

Includes the new method in #122541 so I will merge this as a follow up.

@llvmbot
Copy link
Member

llvmbot commented Jan 15, 2025

@llvm/pr-subscribers-lldb

Author: Jacob Lalonde (Jlalond)

Changes

SBSaveCoreOptions has been around for awhile now, so I decided to draft up some Docstrings describing the functionality better. Some of my wording sounded a bit clunky due the optionality of each method call so I would greatly appreciate feedback.

Includes the new method in #122541 so I will merge this as a follow up.


Full diff: /~https://github.com/llvm/llvm-project/pull/123132.diff

1 Files Affected:

  • (modified) lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i (+72)
diff --git a/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i b/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i
index e69de29bb2d1d6..44e7b672bd2989 100644
--- a/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i
+++ b/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i
@@ -0,0 +1,72 @@
+%feature("docstring",
+"A container for options to use when saving a core file.
+
+SBSaveCoreOptions includes API's to specify the memory regions and threads to include
+when generating a core file. These options are not exclusive the existing SaveCoreStyle option.
+
+Full will save off all thread and memory regions, ignoring the memory regions and threads in
+the options object.
+
+Dirty pages will capture all threads and all rw- memory regions, in addition to the regions specified
+in the options object if they are not already captured.
+
+Stacks will capture all threads, but no memory regions unless specified.
+
+Custom defers entirely to the SBSaveCoreOptions object and will only save what is specified.
+
+Picking custom and specifying nothing will result in an error being returned.
+
+Note that currently ELF Core files are not supported.
+")
+
+%feature("docstring", "
+    Set the plugin name to save a Core file with. Only plugins registered with Plugin manager will be accepted
+    Examples are Minidump and Mach-O."
+) lldb::SBSaveCoreOptions::SetPluginName
+
+%feature("docstring", "
+    Get the specified plugin name, or None if the name is not set."
+) lldb::SBSaveCoreOptions::GetPluginName
+
+%feature("docstring", "
+    Set the lldb.SaveCoreStyle."
+) lldb::SBSaveCoreOptions::SetStyle
+
+%feature("docstring", "
+    Get the specified lldb.SaveCoreStyle, or eSaveCoreUnspecified if not set."
+) lldb::SBSaveCoreOptions::GetStyle
+
+%feature("docstring", "
+    Set the file path to save the Core file at."
+) lldb::SBSaveCoreOptions::SetOutputFile
+
+%feature("docstring", "
+    Get an SBFileSpec corresponding to the specified output path, or none if not set."
+) lldb::SBSaveCoreOptions::GetOutputFile
+
+%feature("docstring", "
+    Set the process to save, or unset a process by providing a default SBProcess. 
+    Resetting will result in the reset of all process specific options, such as Threads to save."
+) lldb::SBSaveCoreOptions::SetProcess
+
+%feature("docstring", "
+    Add an SBThread to be saved, an error will be returned if an SBThread from a different process is specified. 
+    The process is set either by the first SBThread added to the options container, or explicitly by the SetProcess call."
+) lldb::SBSaveCoreOptions::AddThread
+
+%feature("docstring", "
+    Remove an SBthread if present in the container, returns true if a matching thread was found and removed."
+) lldb::SBSaveCoreOptions::RemoveThread
+
+%feature("docstring", "
+    Add a memory region to save, an error will be returned in the region is invalid. 
+    Ranges that overlap will be unioned into a single region."
+) lldb::SBSaveCoreOptions::AddMemoryRegionToSave
+
+%feature("docstring", "
+    Get an SBThreadCollection of all threads marked to be saved. This collection is not sorted according to insertion order."
+) lldb::SBSaveCoreOptions::GetThreadsToSave
+
+%feature("docstring", "
+    Unset all options."
+) lldb::SBSaveCoreOptions::Clear

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few suggestions in terms of wordsmithing.

@@ -0,0 +1,72 @@
%feature("docstring",
"A container for options to use when saving a core file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"A container for options to use when saving a core file.
"A container to specify how to save a core file.

"A container for options to use when saving a core file.

SBSaveCoreOptions includes API's to specify the memory regions and threads to include
when generating a core file. These options are not exclusive the existing SaveCoreStyle option.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
when generating a core file. These options are not exclusive the existing SaveCoreStyle option.
when generating a core file. It extends the existing SaveCoreStyle option.

Comment on lines 7 to 8
Full will save off all thread and memory regions, ignoring the memory regions and threads in
the options object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Full will save off all thread and memory regions, ignoring the memory regions and threads in
the options object.
eSaveCoreFull will save off all thread and memory regions, ignoring the memory regions and threads in
the options object.

Maybe make these bullet points to make it clear that you're iterating over the options, something like this:

* eSaveCoreFull: save off all thread and memory regions, ignoring the memory regions and threads specified in this option object. 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, I wanted to do a list but didn't realize if the docstrings supported markdown.

@Jlalond
Copy link
Contributor Author

Jlalond commented Jan 21, 2025

Hey @JDevlieghere, bump for this patch but also a follow up question. Do I need to manually add docstrings for the constructors for SBProgress, the webpage reflects the method but not the constructor(s).

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@Jlalond Jlalond merged commit d33e33f into llvm:main Jan 21, 2025
5 of 7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 21, 2025

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu running on doug-worker-1a while building lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/181/builds/12112

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
0.016 [123/5/1] Generating VCSRevision.h
0.020 [120/7/2] Building CXX object tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
0.020 [119/7/3] Generating VCSVersion.inc
0.025 [118/7/4] Generating VCSVersion.inc
0.075 [117/7/5] Linking CXX executable bin/llvm-config
0.415 [117/6/6] Building LLDB Python wrapper
FAILED: tools/lldb/bindings/python/LLDBWrapPython.cpp tools/lldb/bindings/python/lldb.py /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/bindings/python/LLDBWrapPython.cpp /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/bindings/python/lldb.py 
cd /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/bindings/python && /usr/bin/swig4.0 -c++ -w361,362,509 -features autodoc -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/bindings -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/bindings/python -c++ -threads -python -py3 -outdir /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/bindings/python -o /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/bindings/python/LLDBWrapPython.cpp /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/bindings/python/python.swig
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/bindings/./interface/SBSaveCoreOptionsDocstrings.i:21: Error: Syntax error in input(1).
0.665 [117/5/7] Building CXX object tools/lldb/source/Version/CMakeFiles/lldbVersion.dir/Version.cpp.o
0.805 [117/4/8] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Version.cpp.o
2.822 [117/3/9] Building CXX object lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
13.548 [117/2/10] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
14.152 [117/1/11] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 21, 2025

LLVM Buildbot has detected a new failure on builder lldb-x86_64-debian running on lldb-x86_64-debian while building lldb at step 4 "build".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/14562

Here is the relevant piece of the build log for the reference
Step 4 (build) failure: build (failure)
1.011 [132/5/1] Generating VCSVersion.inc
1.012 [131/5/2] Generating VCSRevision.h
1.022 [128/7/3] Generating VCSVersion.inc
1.190 [127/7/4] Building LLDB Python wrapper
FAILED: tools/lldb/bindings/python/LLDBWrapPython.cpp tools/lldb/bindings/python/lldb.py /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/bindings/python/LLDBWrapPython.cpp /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/bindings/python/lldb.py 
cd /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/bindings/python && /usr/bin/swig4.0 -c++ -w361,362,509 -features autodoc -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/include -I/home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/include -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/bindings -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/bindings/python -c++ -threads -python -outdir /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/bindings/python -o /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb/bindings/python/LLDBWrapPython.cpp /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/bindings/python/python.swig
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/bindings/./interface/SBSaveCoreOptionsDocstrings.i:21: Error: Syntax error in input(1).
1.373 [127/6/5] Building CXX object tools/lldb/source/Version/CMakeFiles/lldbVersion.dir/Version.cpp.o
1.516 [127/5/6] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Version.cpp.o
2.654 [127/4/7] Building CXX object tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
3.349 [127/3/8] Building CXX object lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
10.870 [127/2/9] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
11.963 [127/1/10] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
ninja: build stopped: subcommand failed.

@Jlalond
Copy link
Contributor Author

Jlalond commented Jan 22, 2025

@dyung Yeah, I'll revert and I'll figure it out tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants