Skip to content

Commit

Permalink
Merge branch 'master' into build/bump-goblin
Browse files Browse the repository at this point in the history
* master:
  build: Bump breakpad/lss submodule
  fix(demangle): Support demangling of block invocations (#229)
  • Loading branch information
jan-auer committed May 7, 2020
2 parents 7f31bd5 + a1a1535 commit 8ced11f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 6 additions & 3 deletions demangle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ fn is_maybe_objc(ident: &str) -> bool {
}

fn is_maybe_cpp(ident: &str) -> bool {
ident.starts_with("_Z") || ident.starts_with("__Z")
ident.starts_with("_Z")
|| ident.starts_with("__Z")
|| ident.starts_with("___Z")
|| ident.starts_with("____Z")
}

fn is_maybe_msvc(ident: &str) -> bool {
ident.starts_with('?') || ident.starts_with("@?")
}

fn is_maybe_switf(ident: &str) -> bool {
fn is_maybe_swift(ident: &str) -> bool {
CString::new(ident)
.map(|cstr| unsafe { symbolic_demangle_is_swift_symbol(cstr.as_ptr()) != 0 })
.unwrap_or(false)
Expand Down Expand Up @@ -216,7 +219,7 @@ impl<'a> Demangle for Name<'a> {
return Language::Cpp;
}

if is_maybe_switf(self.as_str()) {
if is_maybe_swift(self.as_str()) {
return Language::Swift;
}

Expand Down
7 changes: 7 additions & 0 deletions demangle/tests/cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ fn test_demangle_cpp() {
assert_demangle!(Language::Cpp, utils::WITH_ARGS, {
"_Z28JS_GetPropertyDescriptorByIdP9JSContextN2JS6HandleIP8JSObjectEENS2_I4jsidEENS1_13MutableHandleINS1_18PropertyDescriptorEEE" => "JS_GetPropertyDescriptorById(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::PropertyDescriptor>)",
"_ZN12_GLOBAL__N_15startEv" => "(anonymous namespace)::start()",
"__ZN12_GLOBAL__N_15startEv" => "(anonymous namespace)::start()",
"_ZZN12_GLOBAL__N_15helloEvENK3$_0clEv" => "(anonymous namespace)::hello()::$_0::operator()() const",
"_Z3MinIiiEDTqultfp_fp0_cl7forwardIT_Efp_Ecl7forwardIT0_Efp0_EEOS0_OS1_" => "decltype (({parm#1}<{parm#2})?((forward<int>)({parm#1})) : ((forward<int>)({parm#2}))) Min<int, int>(int&&, int&&)",

// Requires cpp_demangle > 0.2.15
// "___ZN19URLConnectionClient33_clientInterface_cancelConnectionEP16dispatch_queue_sU13block_pointerFvvE_block_invoke14" => "invocation function for block in URLConnectionClient::_clientInterface_cancelConnection(dispatch_queue_s*, void () block_pointer)",

// Broken in cpp_demangle
// "_ZN4base8internal13FunctorTraitsIPFvvEvE6InvokeIJEEEvS3_DpOT_" => "void base::internal::FunctorTraits<void (*)(), void>::Invoke<>(void (*)())",
});
Expand All @@ -27,6 +31,9 @@ fn test_demangle_cpp_no_args() {
"_ZN12_GLOBAL__N_15startEv" => "(anonymous namespace)::start",
"_ZZN12_GLOBAL__N_15helloEvENK3$_0clEv" => "(anonymous namespace)::hello()::$_0::operator() const",

// Requires cpp_demangle > 0.2.15
// "___ZN19URLConnectionClient33_clientInterface_cancelConnectionEP16dispatch_queue_sU13block_pointerFvvE_block_invoke14" => "invocation function for block in URLConnectionClient::_clientInterface_cancelConnection",

// Broken in cpp_demangle
// "_ZN4base8internal13FunctorTraitsIPFvvEvE6InvokeIJEEEvS3_DpOT_" => "void base::internal::FunctorTraits<void (*)(), void>::Invoke<>",
// "_Z3MinIiiEDTqultfp_fp0_cl7forwardIT_Efp_Ecl7forwardIT0_Efp0_EEOS0_OS1_" => "decltype (({parm#1}<{parm#2})?((forward<int>)({parm#1})) : ((forward<int>)({parm#2}))) Min<int, int>",
Expand Down

0 comments on commit 8ced11f

Please sign in to comment.