-
Notifications
You must be signed in to change notification settings - Fork 387
Add gchandles and objsize commands to lldb debugger extension #3192
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
Merged
mikem8361
merged 5 commits into
dotnet:main
from
Therzok:dev/therzok/enable-gchandles-objsize
Jul 19, 2022
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2981036
GCHandles should work on all platforms, so remove the artificial cons…
Therzok e126005
Enable objsize in lldb and SOS debugger
Therzok 54ab7ba
Add gchandles command
Therzok 58638a6
It builds!
Therzok f021059
Fix code style
Therzok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Enable objsize in lldb and SOS debugger
- Loading branch information
commit e126005dfc6db2b7ec585e8eb8668d419bd69f27
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ HistStats | |
| IP2MD | ||
| logging | ||
| Name2EE | ||
| ObjectSize | ||
| PrintException | ||
| PathTo | ||
| StopOnCatch | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,8 @@ DumpHeap (dumpheap) EEStack (eestack) | |
| DumpVC ClrStack (clrstack) | ||
| FinalizeQueue (finalizequeue) GCInfo | ||
| GCRoot (gcroot) EHInfo | ||
| PrintException (pe) bpmd (bpmd) | ||
| ObjSize bpmd (bpmd) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you put |
||
| PrintException (pe) | ||
|
|
||
| Examining CLR data structures Diagnostic Utilities | ||
| ----------------------------- ----------------------------- | ||
|
|
@@ -487,6 +488,44 @@ objects, there is a -nostacks option. | |
| The -all option forces all roots to be displayed instead of just the unique roots. | ||
| \\ | ||
|
|
||
| COMMAND: objsize. | ||
| ObjSize [<Object address>] | ||
|
|
||
| With no parameters, ObjSize lists the size of all objects found on managed | ||
| threads. It also enumerates all GCHandles in the process, and totals the size | ||
| of any objects pointed to by those handles. In calculating object size, | ||
| ObjSize includes the size of all child objects in addition to the parent. | ||
|
|
||
| For example, DumpObj lists a size of 20 bytes for this Customer object: | ||
|
|
||
| (lldb) dumpobj a79d40 | ||
| Name: Customer | ||
| MethodTable: 009038ec | ||
| EEClass: 03ee1b84 | ||
| Size: 20(0x14) bytes | ||
| (C:\pub\unittest.exe) | ||
| Fields: | ||
| MT Field Offset Type Attr Value Name | ||
| 009038ec 4000008 4 CLASS instance 00a79ce4 name | ||
| 009038ec 4000009 8 CLASS instance 00a79d2c bank | ||
| 009038ec 400000a c System.Boolean instance 1 valid | ||
|
|
||
| but ObjSize lists 152 bytes: | ||
|
|
||
| (lldb) ObjSize a79d40 | ||
| sizeof(00a79d40) = 152 ( 0x98) bytes (Customer) | ||
|
|
||
| This is because a Customer points to a Bank, has a name, and the Bank points to | ||
| an Address string. You can use ObjSize to identify any particularly large | ||
| objects, such as a managed cache in a web server. | ||
|
|
||
| While running ObjSize with no arguments may point to specific roots that hold | ||
| onto large amounts of memory it does not provide information regarding the | ||
| amount of managed memory that is still alive. This is due to the fact that a | ||
| number of roots can share a common subgraph, and that part will be reported in | ||
| the size of all the roots that reference the subgraph. | ||
| \\ | ||
|
|
||
| COMMAND: pe. | ||
| COMMAND: printexception. | ||
| PrintException [-nested] [-lines] [-ccw] [<Exception object address>] [<CCW pointer>] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add
(objsize)after ObjSize.