diff --git a/debugger/gdbmidebugger.pp b/debugger/gdbmidebugger.pp index 5eb47d5b88..ed98161471 100644 --- a/debugger/gdbmidebugger.pp +++ b/debugger/gdbmidebugger.pp @@ -978,14 +978,22 @@ begin if e <> 0 then Exit; S := Lowercase(ResultInfo.TypeName); - if (S = 'character') - or (S = 'ansistring') - then begin - if Addr = 0 - then AResult := '''''' - else AResult := MakePrintable(GetText(Addr)); - end - else begin + case StringCase(S, ['character', 'ansistring', '__vtbl_ptr_type']) of + 0, 1: begin + if Addr = 0 + then AResult := '''''' + else AResult := MakePrintable(GetText(Addr)); + end; + 2: begin + if Addr = 0 + then AResult := 'nil' + else begin + S := GetClassName(Addr); + if S = '' then S := '???'; + AResult := 'class of ' + S + ' ' + AResult; + end; + end; + else if Addr = 0 then AResult := 'nil'; if S = 'pointer' then Exit; @@ -1001,10 +1009,13 @@ begin skClass: begin Val(AResult, addr, e); if e <> 0 then Exit; - - S := GetInstanceClassName(Addr); - if S = '' then S := '???'; - AResult := S + ' ' + AResult; + if Addr = 0 + then AResult := 'nil' + else begin + S := GetInstanceClassName(Addr); + if S = '' then S := '???'; + AResult := S + ' ' + AResult; + end; end; end; finally diff --git a/debugger/gdbtypeinfo.pp b/debugger/gdbtypeinfo.pp index 86be69d510..ecb704b813 100644 --- a/debugger/gdbtypeinfo.pp +++ b/debugger/gdbtypeinfo.pp @@ -518,6 +518,9 @@ var end; end; end; + +var + HasClass: Boolean; begin Create; @@ -533,7 +536,9 @@ begin S := GetPart(['type = '], [' '], Line); if S = '' then Exit; - if Pos(' = class ', Line) > 0 + HasClass := Pos(' = class ', Line) > 0; + if HasClass + and (S[2] <> '^') // pointer to class is handled next then begin FTypeName := GetPart(['^'], [' '], S); DoClass; @@ -541,7 +546,9 @@ begin else if S[1] = '^' then begin FKind := skPointer; - FTypeName := GetPart(['^'], [' ='], S); + if HasClass + then FTypeName := GetPart(['^^'], [' ='], S) + else FTypeName := GetPart(['^'], [' ='], S); end else if S = 'set' then DoSet