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

lambdas are not minimized #5

Closed
dvyukov opened this issue Jul 5, 2018 · 1 comment
Closed

lambdas are not minimized #5

dvyukov opened this issue Jul 5, 2018 · 1 comment

Comments

@dvyukov
Copy link

dvyukov commented Jul 5, 2018

I am using:

		name := demangle.Filter(frame.Func, demangle.NoParams, demangle.NoTemplateParams)

with the intent of getting reasonable traces (i.e. not a dozen of lines per frame) for heavy C++ code, e.g.:

bt#04: 0x001619ba SocketDispatcher::WriteSelfLocked object/socket_dispatcher.cpp:275
bt#05: 0x00161a39 SocketDispatcher::Write object/socket_dispatcher.cpp:212
bt#06: 0x0018bf7b sys_socket_write syscalls/socket.cpp:68
bt#07: [ inline ] operator() syscall-kernel-wrappers.inc:204
bt#07: [ inline ] socket_write syscalls/syscalls.cpp:60
bt#07: 0x0016f9a4 wrapper_socket_write syscall-kernel-wrappers.inc:206
bt#08: 0x00115e7f x86_syscall syscall-kernel-branches.S:34

but in some cases I am getting something like (which is not qualified as reasonable):

bt#12: [ inline ] ForEachChildInLocked<fbl::DoublyLinkedList<JobDispatcher*, JobDispatcher::ListTraitsRaw>, JobDispatcher::EnumerateChildren(JobEnumerator*, bool)::<lambda(fbl::RefPtr<JobDispatcher>)> > object/job_dispatcher.cpp:94
bt#12: 0x001553f5 JobDispatcher::EnumerateChildren object/job_dispatcher.cpp:388
bt#13: [ inline ] operator() object/job_dispatcher.cpp:394
bt#13: [ inline ] ForEachChildInLocked<fbl::DoublyLinkedList<JobDispatcher*, JobDispatcher::ListTraitsRaw>, JobDispatcher::EnumerateChildren(JobEnumerator*, bool)::<lambda(fbl::RefPtr<JobDispatcher>)> > object/job_dispatcher.cpp:94
bt#13: 0x001553f5 JobDispatcher::EnumerateChildren object/job_dispatcher.cpp:388
bt#14: [ inline ] operator() object/job_dispatcher.cpp:394
bt#14: [ inline ] ForEachChildInLocked<fbl::DoublyLinkedList<JobDispatcher*, JobDispatcher::ListTraitsRaw>, JobDispatcher::EnumerateChildren(JobEnumerator*, bool)::<lambda(fbl::RefPtr<JobDispatcher>)> > object/job_dispatcher.cpp:94
bt#14: 0x001553f5 JobDispatcher::EnumerateChildren object/job_dispatcher.cpp:388
bt#15: [ inline ] operator() object/job_dispatcher.cpp:394
bt#15: [ inline ] ForEachChildInLocked<fbl::DoublyLinkedList<JobDispatcher*, JobDispatcher::ListTraitsRaw>, JobDispatcher::EnumerateChildren(JobEnumerator*, bool)::<lambda(fbl::RefPtr<JobDispatcher>)> > object/job_dispatcher.cpp:94
bt#15: 0x001553f5 JobDispatcher::EnumerateChildren object/job_dispatcher.cpp:388

I see that tests in demangle_test.go explicitly test for such behavior. Is it intentional? Shouldn't NoParams/NoTemplateParams also strip all that from lambdas and it's context?

FTR, one symbol example is _ZZ13platform_initENUlN6smbios11SpecVersionEPKNS_6HeaderERKNS_11StringTableEPvE_4_FUNES0_S3_S6_S7_.

dvyukov added a commit to google/syzkaller that referenced this issue Jul 5, 2018
demangle package does not minimize lambda symbols properly
(does not strip parameters and template paratemeter).
Do it manually.

See: ianlancetaylor/demangle#5
@ianlancetaylor
Copy link
Owner

One of the goals of this package is to act, as much as possible, like as the demangler distributed with GCC. The file testdata/demangle-expected is copied from GCC. And indeed for your sample symbol _ZZ13platform_initENUlN6smbios11SpecVersionEPKNS_6HeaderERKNS_11StringTableEPvE_4_FUNES0_S3_S6_S7_ the c++filt program in this package produces the same output as the c++filt program that comes with GCC.

So maybe the first step is to file a bug against GCC asking that that demangler be changed. Or, of course, we could add another option here, but that doesn't seem like the best choice.

@dvyukov dvyukov closed this as completed Jul 16, 2018
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

No branches or pull requests

2 participants