From b12ced369a15022c9c8d2d7b8885ef964fd8c007 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 7 Jun 2016 21:47:32 +0300 Subject: [PATCH] lldbmi2 support fixes; better demangling of strange corrupted symbols under DMD OSX --- src/ddebug/gdb/gdbmiparser.d | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ddebug/gdb/gdbmiparser.d b/src/ddebug/gdb/gdbmiparser.d index ca8ba1d..8c1fb85 100644 --- a/src/ddebug/gdb/gdbmiparser.d +++ b/src/ddebug/gdb/gdbmiparser.d @@ -54,11 +54,17 @@ MIValue parseMI(string s) { } } -string demangleFunctionName(string fn) { - if (!fn) - return fn; - if (!fn.startsWith("_D")) - return fn; +string demangleFunctionName(string mangledName) { + import std.ascii; + if (!mangledName) + return mangledName; + string fn = mangledName; + if (!fn.startsWith("_D")) { + // trying to fix strange corrupted mangling under OSX/dmd/lldb + if (fn.length < 3 || fn[0]!='D' || !isDigit(fn[1])) + return mangledName; + fn = "_" ~ mangledName; + } import std.demangle; import std.ascii; //import core.demangle : Demangle; @@ -72,7 +78,7 @@ string demangleFunctionName(string fn) { } catch (Exception e) { // cannot demangle Log.v("Failed to demangle " ~ fn[0..i]); - return fn; + return mangledName; } }