dwarves icon indicating copy to clipboard operation
dwarves copied to clipboard

fprintf: preserve conf_fprintf pointer in tag__ptr_name

Open a1batross opened this issue 3 years ago • 7 comments

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 avatar Apr 18 '22 19:04 a1batross

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?

a1batross avatar Apr 18 '22 22:04 a1batross

Em Mon, Apr 18, 2022 at 03:57:15PM -0700, a1batross escreveu:

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

Yes, @.*** is the list to post patches, etc.

  • Arnaldo

@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?

-- Reply to this email directly or view it on GitHub: https://github.com/acmel/dwarves/pull/29#issuecomment-1101834802 You are receiving this because you were mentioned.

Message ID: @.***>

--

  • Arnaldo

acmel avatar Apr 20 '22 12:04 acmel

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

acmel avatar Apr 20 '22 12:04 acmel

$ 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.

acmel avatar Apr 20 '22 12:04 acmel

@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 avatar Apr 22 '22 11:04 a1batross

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

a1batross avatar Apr 22 '22 11:04 a1batross

Em Fri, Apr 22, 2022 at 04:36:12AM -0700, a1batross escreveu:

@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 EngineCallback.cpp.1.o > pre-patch.h
$ ./pahole-post-patch 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

thanks, this should be enough, I added the above test output and description to the cset and merged it.

Will surface on master after the libbpf regression test passes.

  • Arnaldo

acmel avatar Apr 22 '22 17:04 acmel