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

pointer chain information is not adequate to rebuild data structure #2

Open
kortschak opened this issue Mar 24, 2015 · 0 comments
Open
Labels

Comments

@kortschak
Copy link
Owner

Given an adequately clever parser and type constructor, we still cannot unambiguously recreate a data structure from the output of utter when there are pointers to non-pointer values.

In the case of pointers to concrete values, there is no address information given for the target, so for example:

c := []interface{}{5, 5, nil, nil}
c[2] = &c[0]
c[3] = &c[0]

ptrDump := utter.NewDefaultConfig()
ptrDump.CommentPointers = true

ptrDump(c)

gives:

[]interface{}{
    int(5),
    int(5),
    &int /*0xc20803e840*/ (5),
    &int /*0xc20803e840*/ (5),
}

To get this information and only report it where necessary we need to walk the structure once before the dump and mark concrete values that are referenced by a pointer.

Another complication is of how to deal with pointers into []byte. To not interfere with []byte formatting, I think the best approach is to add an appendix comment to []byte rendering to list elements that are referenced and their addresss.

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

No branches or pull requests

1 participant