-
Notifications
You must be signed in to change notification settings - Fork 65
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
Helper files for debuggers #1158
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
12d6ce7
First (skeleton) commit of debugger helpers
Arlie-Capps 5d59a39
We can now see objects and numeric Nodes.
Arlie-Capps 39c9e8c
In Debug, depend on Totalview include directories if given
Arlie-Capps d717893
Try for a Totalview C++View function
Arlie-Capps fe3f967
Support object Nodes
Arlie-Capps a54ed4d
Edits to tighten up the Totalview helper
Arlie-Capps 8a289cc
GDB debugger is closer
Arlie-Capps d8fcd30
Added start of documentation of the debugger integration
Arlie-Capps e9b075f
Fixes, closer on the object printer
Arlie-Capps 2fc3617
Merge branch 'develop' into feature/capps2/debughelpers
cyrush dc41518
More details in documentation, along with screenshots.
Arlie-Capps 5989239
Adjust Totalview screenshots for clarity
Arlie-Capps 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
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit | ||
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
# other details. No copyright assignment is required to contribute to Conduit. | ||
|
||
import gdb.printing | ||
import itertools | ||
|
||
|
||
class HostDevicePtrPrinter: | ||
"""Print a host_device_ptr object.""" | ||
|
||
def __init__(self, val): | ||
self.val = val | ||
|
||
def to_string(self): | ||
num_elements = self.val['m_elems'] | ||
|
||
if num_elements > 0: | ||
return "{{ size = {0} }}".format(num_elements) | ||
else: | ||
return "nullptr" | ||
|
||
def display_hint(self): | ||
return 'array' | ||
|
||
def children (self): | ||
for i in range(self.val['m_elems']): | ||
yield "[{0}]".format(i), self.val['m_active_pointer'][i] | ||
|
||
|
||
def build_pretty_printer(): | ||
pp = gdb.printing.RegexpCollectionPrettyPrinter("care") | ||
pp.add_printer('host_device_ptr', 'host_device_ptr', HostDevicePtrPrinter) | ||
return pp | ||
|
||
|
||
gdb.printing.register_pretty_printer(gdb.current_objfile(), build_pretty_printer()) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> | ||
<Type Name="conduit::Node"> | ||
<!-- Node can be empty, object, list, or leaf. --> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_EMPTY_ID">empty conduit::Node</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_OBJECT_ID">object {{ size: { m_children.size() } }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_LIST_ID">list {{ size: { m_children.size() } }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_INT8_ID">int8 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_INT16_ID">int16 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_INT32_ID">int32 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_INT64_ID">int64 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_UINT8_ID">uint8 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_UINT16_ID">uint16 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_UINT32_ID">int32 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_UINT64_ID">int64 {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_FLOAT32_ID">float {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_FLOAT64_ID">double {{ size: {m_schema->m_dtype.m_num_ele} }}</DisplayString> | ||
<DisplayString Condition="m_schema->m_dtype.m_id == CONDUIT_CHAR8_STR_ID">string: { (char *)m_data }</DisplayString> | ||
<DisplayString>leaf value</DisplayString> | ||
<Expand> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_LIST_ID"> | ||
<Size>m_children.size()</Size> | ||
<ValuePointer>m_children._Mypair._Myval2._Myfirst</ValuePointer> | ||
</ArrayItems> | ||
<CustomListItems Condition="m_schema->m_dtype.m_id == CONDUIT_OBJECT_ID"> | ||
<Variable Name="i" InitialValue="0"/> | ||
<Variable Name="hier" InitialValue="(conduit::Schema::Schema_Object_Hierarchy *)(m_schema->m_hierarchy_data)"/> | ||
<Size>m_children.size()</Size> | ||
<Loop Condition="i<m_children.size()"> | ||
<!-- This works only if the order of the children hasn't been messed up. --> | ||
<!-- I haven't found a way to get a temporary Node here in the loop. --> | ||
<Item Name="{hier->object_order[i]}">m_children[i]</Item> | ||
<Exec>i++</Exec> | ||
</Loop> | ||
</CustomListItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_INT8_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(signed char *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_INT16_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(signed short *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_INT32_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(signed int *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_INT64_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(signed long *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_UINT8_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(unsigned char *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_UINT16_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(unsigned short *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_UINT32_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(unsigned int *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_UINT64_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(unsigned long *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_FLOAT32_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(float *)m_data</ValuePointer> | ||
</ArrayItems> | ||
<ArrayItems Condition="m_schema->m_dtype.m_id == CONDUIT_FLOAT64_ID"> | ||
<Size>m_schema->m_dtype.m_num_ele</Size> | ||
<ValuePointer>(double *)m_data</ValuePointer> | ||
</ArrayItems> | ||
</Expand> | ||
</Type> | ||
</AutoVisualizer> |
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit | ||
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and | ||
# other details. No copyright assignment is required to contribute to Conduit. | ||
|
||
::TV::TTF::RTF::build_struct_transform { | ||
name {^(class|struct) (conduit::)?Node$} | ||
members { | ||
{ size { m_elems } } | ||
{ data { m_active_pointer} } | ||
} | ||
} |
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.
This works in the simple case, for objects that get created and never have Nodes removed. I don't know if I can get this to work in the general case, where the order might get perturbed.