https://github.com/barsolo2000 updated https://github.com/llvm/llvm-project/pull/149903
>From e9fdc0a001823db1df26158845301aec94cd2b8a Mon Sep 17 00:00:00 2001 From: Bar Soloveychik <bars...@fb.com> Date: Mon, 21 Jul 2025 13:29:58 -0700 Subject: [PATCH 1/3] added documenatation on GetDescription --- .../interface/SBMemoryRegionInfoDocstrings.i | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index d7c68baf100e2..dd578f53c828c 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,31 +1,43 @@ -%feature("docstring", -"API clients can get information about memory regions in processes." -) lldb::SBMemoryRegionInfo; +% feature("docstring", + "API clients can get information about memory regions in processes.") + lldb::SBMemoryRegionInfo; %feature("docstring", " Returns whether this memory region has a list of modified (dirty) pages available or not. When calling GetNumDirtyPages(), you will - have 0 returned for both \"dirty page list is not known\" and + have 0 returned for both \"dirty page list is not known\" and \"empty dirty page list\" (that is, no modified pages in this memory region). You must use this method to disambiguate." ) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList; -%feature("docstring", " - Return the number of dirty (modified) memory pages in this - memory region, if available. You must use the - SBMemoryRegionInfo::HasDirtyMemoryPageList() method to - determine if a dirty memory list is available; it will depend - on the target system can provide this information." -) lldb::SBMemoryRegionInfo::GetNumDirtyPages; +% feature( + "docstring", + " + Return the number of dirty(modified) memory pages in this memory region, + if available.You must use the SBMemoryRegionInfo::HasDirtyMemoryPageList() + method to determine if a dirty memory list is available; + it will depend on the target system can provide this information." + ) lldb::SBMemoryRegionInfo::GetNumDirtyPages; -%feature("docstring", " - Return the address of a modified, or dirty, page of memory. - If the provided index is out of range, or this memory region - does not have dirty page information, LLDB_INVALID_ADDRESS - is returned." -) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; +% feature("docstring", + " + Return the address of a modified, + or dirty, page of memory.If the provided index is out of range, + or this memory region does not have dirty page information, + LLDB_INVALID_ADDRESS is returned." + ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; + +% feature("docstring", " + Return the size of pages in this memory region .0 will be + returned if this information was unavailable." + ) lldb::SBMemoryRegionInfo::GetPageSize(); %feature("docstring", " - Return the size of pages in this memory region. 0 will be returned - if this information was unavailable." -) lldb::SBMemoryRegionInfo::GetPageSize(); + takes a SBStream parameter 'description' where it will write the output to. + it formats the memory region information into a string with Memory region info + [Hex start - Hex End) and premission flags R/W/X + returns a boolean value indicating success or failure + + alternative to using this method to find out the size of the memory region + is to use the len() function on the SBMemoryRegionInfo object" +) lldb::SBMemoryRegionInfo::GetDescription; >From 17f46d31903ab451a5944d4097ae1ef62bd631cc Mon Sep 17 00:00:00 2001 From: Bar Soloveychik <bars...@fb.com> Date: Mon, 21 Jul 2025 14:08:01 -0700 Subject: [PATCH 2/3] added doc on str/len overwritten functions --- .../interface/SBMemoryRegionInfoDocstrings.i | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index dd578f53c828c..6b7f4a32ed17e 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,5 +1,8 @@ % feature("docstring", - "API clients can get information about memory regions in processes.") + "API clients can get information about memory regions in processes. + + When printed using str(), the memory region info is formatted as: + '[Hex start - Hex End] RWX' ") lldb::SBMemoryRegionInfo; %feature("docstring", " @@ -34,10 +37,11 @@ %feature("docstring", " takes a SBStream parameter 'description' where it will write the output to. - it formats the memory region information into a string with Memory region info - [Hex start - Hex End) and premission flags R/W/X - returns a boolean value indicating success or failure + The function will formats the memory region information into a string with Memory region info + [Hex start - Hex End) and premission flags R/W/X. + Returns a boolean value indicating success or failure. - alternative to using this method to find out the size of the memory region - is to use the len() function on the SBMemoryRegionInfo object" + alternatively, to get the size of the memory region is to use + the len() function on the SBMemoryRegionInfo object. + The function function will return the size of the memory region" ) lldb::SBMemoryRegionInfo::GetDescription; >From 248082579858ea58235d2946d27e9f25e879e05f Mon Sep 17 00:00:00 2001 From: Bar Soloveychik <bars...@fb.com> Date: Mon, 21 Jul 2025 14:48:24 -0700 Subject: [PATCH 3/3] fixed comments from previous commit --- .../interface/SBMemoryRegionInfoDocstrings.i | 64 +++++++++---------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index 6b7f4a32ed17e..1bb1433e2046d 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,9 +1,8 @@ -% feature("docstring", - "API clients can get information about memory regions in processes. +%feature("docstring", + "API clients can get information about memory regions in processes. - When printed using str(), the memory region info is formatted as: - '[Hex start - Hex End] RWX' ") - lldb::SBMemoryRegionInfo; + For Python users, `len()` is overriden to output the size of the memory region in bytes." + ) lldb::SBMemoryRegionInfo; %feature("docstring", " Returns whether this memory region has a list of modified (dirty) @@ -11,37 +10,36 @@ have 0 returned for both \"dirty page list is not known\" and \"empty dirty page list\" (that is, no modified pages in this memory region). You must use this method to disambiguate." -) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList; + ) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList; -% feature( - "docstring", - " - Return the number of dirty(modified) memory pages in this memory region, - if available.You must use the SBMemoryRegionInfo::HasDirtyMemoryPageList() - method to determine if a dirty memory list is available; - it will depend on the target system can provide this information." - ) lldb::SBMemoryRegionInfo::GetNumDirtyPages; +%feature( + "docstring", + " + Return the number of dirty(modified) memory pages in this memory region, + if available.You must use the SBMemoryRegionInfo::HasDirtyMemoryPageList() + method to determine if a dirty memory list is available; + it will depend on the target system can provide this information." + ) lldb::SBMemoryRegionInfo::GetNumDirtyPages; -% feature("docstring", - " - Return the address of a modified, - or dirty, page of memory.If the provided index is out of range, - or this memory region does not have dirty page information, - LLDB_INVALID_ADDRESS is returned." - ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; +%feature("docstring", + " + Return the address of a modified, + or dirty, page of memory.If the provided index is out of range, + or this memory region does not have dirty page information, + LLDB_INVALID_ADDRESS is returned." + ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; -% feature("docstring", " - Return the size of pages in this memory region .0 will be - returned if this information was unavailable." - ) lldb::SBMemoryRegionInfo::GetPageSize(); +%feature("docstring", " + Return the size of pages in this memory region .0 will be + returned if this information was unavailable." + ) lldb::SBMemoryRegionInfo::GetPageSize; %feature("docstring", " - takes a SBStream parameter 'description' where it will write the output to. - The function will formats the memory region information into a string with Memory region info - [Hex start - Hex End) and premission flags R/W/X. - Returns a boolean value indicating success or failure. + Takes an SBStream parameter to write output to, + formatted [Hex start - Hex End) with associated permissions (RWX). + If the function results false, no output will be written. + If results true, the output will be written to the stream. - alternatively, to get the size of the memory region is to use - the len() function on the SBMemoryRegionInfo object. - The function function will return the size of the memory region" -) lldb::SBMemoryRegionInfo::GetDescription; + For Python users, `str()` is overriden with the results of this function. + " + ) lldb::SBMemoryRegionInfo::GetDescription; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits