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

fprintf: preserve conf_fprintf pointer in tag__ptr_name #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

a1batross
Copy link
Contributor

This fixes the use of classes_as_structs and probably other options, when
fprintf meets a pointer/reference type.

Signed-off-by: Alibek Omarov [email protected]

This fixes the use of classes_as_structs and probably other options, when
fprintf meets a pointer/reference type.

Signed-off-by: Alibek Omarov <[email protected]>
@a1batross
Copy link
Contributor Author

Unrelated to PR, I see there is a mailing list available. https://lore.kernel.org/dwarves/

@acmel do you mind publishing an address where patches should be sent, if it is public at all and accepts without subscription or manual approval. Or is GitHub should be preferred method?

@acmel
Copy link
Owner

acmel commented Apr 20, 2022 via email

@acmel
Copy link
Owner

acmel commented Apr 20, 2022

yeah, dwarves at vger . kernel . org is the mailing list for pahole.

@acmel
Copy link
Owner

acmel commented Apr 20, 2022

$ pahole vmlinux > after
$ diff -u before after
$

So I think I need some C++ .o to see changes, please consider providing one together with before/after so that we can see quickly the effect of the patch. I'm grabbing one from some random debuginfo file now.

@a1batross
Copy link
Contributor Author

a1batross commented Apr 22, 2022

@acmel ok, there is simple example I took from my own C++ library: https://github.com/FWGS/mainui_cpp/blob/master/EngineCallback.cpp. It implements GUI in a game engine written in C.

I compiled pahole with this patch and without, and ran with --classes_as_struct flag, as this patch fixes this case in the first place:

$ ./pahole-pre-patch --classes_as_structs EngineCallback.cpp.1.o > pre-patch.h
$ ./pahole-post-patch --classes_as_structs EngineCallback.cpp.1.o > post-patch.h
$ diff -u pre-patch.h post-patch.h | tail -n 20
-       void Update(class CWindowStack *);
+       void Update(struct CWindowStack *);
 
-       void KeyUpEvent(class CWindowStack *, int);
+       void KeyUpEvent(struct CWindowStack *, int);
 
-       void KeyDownEvent(class CWindowStack *, int);
+       void KeyDownEvent(struct CWindowStack *, int);
 
-       void CharEvent(class CWindowStack *, int);
+       void CharEvent(struct CWindowStack *, int);
 
-       void MouseEvent(class CWindowStack *, int, int);
+       void MouseEvent(struct CWindowStack *, int, int);
 
-       void InputMethodResized(class CWindowStack *);
+       void InputMethodResized(struct CWindowStack *);
 
        struct CUtlLinkedList<CMenuBaseWindow*, int> stack; /*     0    56 */
        int                        active;               /*    56     4 */

I uploaded the diff in the attachments, if you want to look closely. diff.txt

@a1batross
Copy link
Contributor Author

Ran without any flags, the result is the same without and with patch:

$ ./pahole-post-patch EngineCallback.cpp.1.o > post-patch-default.h
$ ./pahole-pre-patch EngineCallback.cpp.1.o > pre-patch-default.h
$ diff -u post-patch-default.h pre-patch-default.h && echo No changes
No changes

@acmel
Copy link
Owner

acmel commented Apr 22, 2022 via email

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

Successfully merging this pull request may close these issues.

2 participants