|
Bugzilla – Full Text Bug Listing |
| Summary: | Automatic demangling of Callback function signatures when they mismatch | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | TimoB <timo.bingmann> |
| Component: | core | Assignee: | ns-bugs <ns-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | mathieu.lacage, raj.b, tomh |
| Priority: | P3 | ||
| Version: | ns-3-dev | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | Demangling | ||
Looks good to me. Do you have commit powers to ns-3-dev ? Nope. Talked to Tom today to get a user account first. You have any idea how to cast before printing? (In reply to comment #2) > You have any idea how to cast before printing? Nope, I don't see how you could cast to the right type: you would need to know the type of the object you got before casting it and you can't obviously do this since you don't know what you got. one small nit before you commit, to strip this comment +// Demangling calls based on __cxa_demangle - Author: Timo Bingmann, 2009 to avoid authorship comments in the source code Otherwise, I think it is a great addition. Okay, I was more about who's to blame for problems. But we know this thru hg anyway, right? (In reply to comment #5) > Okay, I was more about who's to blame for problems. > But we know this thru hg anyway, right? > Yes, that is the idea. 4205:751691462d36 |
Created attachment 383 [details] Demangling This bugged me one time too many: Incompatible types. (feed to "c++filt -t") got=N3ns319FunctorCallbackImplIPFvSsNS_3PtrIKNS_6PacketEEEdNS_8WifiModeEEvSsS4_dS5_NS_5emptyES8_S8_S8_S8_EE expected=PN3ns312CallbackImplIvSsNS_3PtrIKNS_6PacketEEEdNS_8WifiModeENS_12WifiPreambleENS_5emptyES7_S7_S7_EE Because I connected an incompatible callback function to a TraceSource. My patch uses abi::__cxa_demangle to convert the names above to Incompatible types. (feed to "c++filt -t" if needed) got=ns3::FunctorCallbackImpl<void (*)(std::string, ns3::Ptr<ns3::Packet const>, double, ns3::WifiMode), void, std::string, ns3::Ptr<ns3::Packet const>, double, ns3::WifiMode, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> expected=ns3::CallbackImpl<void, std::string, ns3::Ptr<ns3::Packet const>, double, ns3::WifiMode, ns3::WifiPreamble, ns3::empty, ns3::empty, ns3::empty, ns3::empty>* Not really much better, but at least I can read something now. Maybe someone knows how to cast the "got" function to CallbackImpl before printing. That would improve legibility.