lldb won't let me call profiler_save_profile_to_file from the debugger because of baseprofiler ambiguity
Categories
(Core :: Gecko Profiler, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox103 | --- | fixed |
People
(Reporter: mstange, Assigned: mozbugz)
Details
Attachments
(1 file)
I was trying to get a profile of a hung Firefox parent process today.
Target 0: (firefox) stopped.
(lldb) p (void)profiler_save_profile_to_file("/Users/mstange/Desktop/hang.json")
error: expression failed to parse:
error: <user expression 0>:1:7: call to 'profiler_save_profile_to_file' is ambiguous
(void)profiler_save_profile_to_file("/Users/mstange/Desktop/hang.json")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: candidate function
note: candidate function
(lldb)
| Reporter | ||
Comment 1•4 years ago
|
||
To work around this, I commented out the baseprofiler version of this function and the call from TestBaseProfiler.cpp.
| Assignee | ||
Comment 2•4 years ago
|
||
The Base Profiler version is in the mozilla::baseprofiler namespace, while the other one is in the root namespace.
Markus, could you please try adding an explicit namespace, i.e. ::profiler_save_profile_to_file(...)?
If it's still not working, or just to avoid these annoyances, we could rename clashing Base Profiler functions anyway.
| Reporter | ||
Comment 3•4 years ago
|
||
I think I tried that and it gave me the same error.
| Reporter | ||
Comment 4•4 years ago
|
||
Ah, probably because both have the extern "C" declaration, and C exports don't know anything about namespaces.
| Assignee | ||
Comment 5•4 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #4)
Ah, probably because both have the
extern "C"declaration, and C exports don't know anything about namespaces.
I only see extern "C" around the Gecko Profiler's profiler_save_profile_to_file.
The Base Profiler one is declared with MFBT_API, is that acting like a C export as well?
Anyway, it sounds like it's causing troubles, so we should consider renaming...
| Assignee | ||
Comment 6•4 years ago
|
||
Calling profiler_save_profile_to_file from lldb errored with "call to 'profiler_save_profile_to_file' is ambiguous", even though they're in different namespaces.
Updated•4 years ago
|
| Reporter | ||
Comment 7•4 years ago
|
||
(In reply to Gerald Squelart [:gerald] (he/him) from comment #5)
(In reply to Markus Stange [:mstange] from comment #4)
Ah, probably because both have the
extern "C"declaration, and C exports don't know anything about namespaces.I only see
extern "C"around the Gecko Profiler'sprofiler_save_profile_to_file.
The Base Profiler one is declared withMFBT_API, is that acting like a C export as well?
Oh, huh, no idea. Then I'm not exactly sure what causes the collision.
Description
•