View Issue Details

IDProjectCategoryView StatusLast Update
0035930FPCCompilerpublic2019-08-10 20:13
ReporterGeorgeAssigned To 
Status newResolutionopen 
Product Version3.0.4Product Build 
Target VersionFixed in Version 
Summary0035930: LLDB crash on a procedural type use
DescriptionLLDB crashes if a variable of procedural type (methods as well) is examined - stack trace included.
Reproduced with LLDB v9.0.0 (nightly build) on Windows10 64bit as well as LLDB v6.0.0 on Linux 64 bit.
FPC options: -dDEBUG -gw2 -CroiO -O1
Probably this is not FPC bug but LLDB one. But a workaround is highly desirable as LLDB is a good debugger. It allows to examine dynamic arrays while debugging for example.
And it's almost the only option on OSX.
I'm not a DWARF expert but as a workaround I can suggest to report to debug info procedural types as pointer and method types as a record as these types seems cause no problems to LLDB.
Steps To ReproduceRun lldb with the sample program:
1. lldb Test33
Issue LLDB commands:
2. b Test33.pas:15
3. r
4. p this
Additional Information{$MODE Delphi}
program Test33;

  TProcedure = procedure();

  TTest = class
    proc : TProcedure;
    constructor Create();

constructor TTest.Create();
var a: integer;
  a := 9;
  proc := nil;

  Test : TTest;

  Test := TTest.create();

LLDB crash trace:
Assertion failed: Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!", file C:\src\llvm_package_363781\llvm\lib\IR\DataLayout.cpp, line 699
Stack dump:
0. Program arguments: C:\app\LLVM\bin\lldb-mi.exe Z:\src\g3ge\bin\Test33.exe
0x00007FF74756CED6 (0x00007FF74756CED0 0x00007FFF57CA9241 0x0000009000000002 0x00007FFF57D78510)
0x00007FFF57CFD09B (0x0000000000000201 0x00007FFF00000000 0x00000000000002BB 0x00007FFF33863D9C), raise() + 0x1DB bytes(s)
0x00007FFF57CFE131 (0x00007FFF00000003 0x00007FFF00000003 0x00007FFF33863D9C 0x00007FFF34F4ED00), abort() + 0x31 bytes(s)
0x00007FFF57CFFE31 (0x00000000000002BB 0x00007FFF33863D9C 0x000048B16AD5E12B 0x0000021E04B92C60), _get_wpgmptr() + 0x1C31 bytes(s)
0x00007FFF57D0011F (0x0000000000008A7E 0x00007FFF3374FA3C 0x00007FFF3376D9FE 0x0000021E04BB6858), _wassert() + 0x3F bytes(s)
0x00007FFF33454892 (0x000000904498A9C8 0x0000000000000001 0x0000021E04BC4B40 0x000000904498A8C0), ??0SBBlock@lldb@@AEAA@PEAVBlock@lldb_private@@@Z() + 0x2DAF22 bytes(s)
0x00007FFF318A08C9 (0x0000021E04BB6AF8 0x0000021E01DA4D40 0x0000021E01DA0CC0 0x00007FFF00000000), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x8D5D39 bytes(s)
0x00007FFF3189E0BB (0x0000000000000210 0x0000021E01DA1C80 0x0000021E01DA1C80 0x0000021E04B5D9D0), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x8D352B bytes(s)
0x00007FFF315EAE71 (0x000048B16AD5EBAB 0x0000000000000008 0x0000021E00000008 0x000000904498AEF0), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x6202E1 bytes(s)
0x00007FFF315E8F5A (0x0000000000000000 0x00007FFF57C99686 0x0000000000000080 0x0000000000000080), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x61E3CA bytes(s)
0x00007FFF315E955F (0x000000904498AFB0 0x0000021E01DA1C80 0x000000904498AFC0 0x0000002000000002), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x61E9CF bytes(s)
0x00007FFF317928C2 (0x0000021E04B002D0 0x0000000000000000 0x000000000000000B 0x00007FFF2FDD39B5), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x7C7D32 bytes(s)
0x00007FFF31792CED (0x0000021E04AFA570 0x0000021E04BB6FE0 0x0000021E04BBE3D0 0x0000021E04B4C860), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x7C815D bytes(s)
0x00007FFF31792E55 (0x0000021E03B4D340 0x000000904498B3B8 0x000000904498BB00 0x00007FFF57C988DB), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x7C82C5 bytes(s)
0x00007FFF317930BD (0x0000021E01DA1C80 0x0000000000000000 0x894300203A010000 0x0000000001E30D00), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x7C852D bytes(s)
0x00007FFF31579CCD (0x0000021E049B4A50 0x0000021E04BBE530 0x000000904498CBE8 0x00007FFF324F7000), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x5AF13D bytes(s)
0x00007FFF3157240C (0x0000000000000004 0x000000904498CC78 0x0000000000000000 0x0001000001010001), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x5A787C bytes(s)
0x00007FFF3157696A (0x00007FFF57D000E0 0x00007FFF3334F4F9 0x000048B16AD58B5B 0x0000021E04AFB360), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x5ABDDA bytes(s)
0x00007FFF3157D6D1 (0x000000900000030C 0x0000000000000000 0x5F62646C6C5F5F24 0x0000000072707865), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x5B2B41 bytes(s)
0x00007FFF315608FF (0x0000000000000000 0x0000021E04AFB6D0 0x0000000000000000 0x0000000000000000), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0x595D6F bytes(s)
0x00007FFF2FB7C55A (0x0000021E049B7440 0x0000021E049B7420 0x0000021E049AAAF0 0x00007FFF33747A0F), ?SetSP@SBTrace@lldb@@IEAAXAEBV?$shared_ptr@VProcess@lldb_private@@@std@@@Z() + 0x5992A bytes(s)
0x00007FFF31E64325 (0x000000904498EF68 0x00007FFF46255501 0x0000021E03958300 0x000000904498E790), ?SetSymbol@SBSymbol@lldb@@AEAAXPEAVSymbol@lldb_private@@@Z() + 0xE99795 bytes(s)
0x00007FFF2FB74A1B (0x0000000000000001 0x0000021E0397E060 0x0000021E04B695D0 0x000000904498EE20), ?SetSP@SBTrace@lldb@@IEAAXAEBV?$shared_ptr@VProcess@lldb_private@@@std@@@Z() + 0x51DEB bytes(s)
0x00007FFF2FB74C77 (0x0000021E03958860 0x0000021E0395A220 0x0000021E00000000 0x0000021E01DA0000), ?SetSP@SBTrace@lldb@@IEAAXAEBV?$shared_ptr@VProcess@lldb_private@@@std@@@Z() + 0x52047 bytes(s)
0x00007FFF2FB40C6C (0x000000904498F130 0x00007FFF57C988DB 0x0000009000000000 0x0000021E01DA0000), ?SetSP@SBTrace@lldb@@IEAAXAEBV?$shared_ptr@VProcess@lldb_private@@@std@@@Z() + 0x1E03C bytes(s)
0x00007FFF2F959F13 (0x0000000000000002 0x0000021E03B11748 0x000000904498EFD0 0x0000021E04AE81E8), ??1SBCommandPluginInterface@lldb@@UEAA@XZ() + 0xA5B83 bytes(s)
0x00007FFF2FA45E60 (0x0000000000000002 0x00007FFF00000000 0x000000000000000F 0x00007FFF462555E3), ?get@SBBroadcaster@lldb@@IEBAPEAVBroadcaster@lldb_private@@XZ() + 0x37F20 bytes(s)
0x00007FFF2F667BB3 (0x000000000000000F 0x0000000000000000 0x00007FFF33776388 0x0000000000000035), ?EvaluateExpression@SBFrame@lldb@@QEAA?AVSBValue@2@PEBDAEBVSBExpressionOptions@2@@Z() + 0x3A3 bytes(s)
0x00007FFF2F6676A2 (0x0000000000000000 0x0000000000000000 0x000090E39A0CB500 0x000000904498F3B8), ?EvaluateExpression@SBFrame@lldb@@QEAA?AVSBValue@2@PEBD@Z() + 0x312 bytes(s)
0x00007FF74753454F (0x000000000000000F 0x00007FF7475982D0 0x616572632D726100 0x20646E616D006574)
0x00007FF74753D0DA (0x000000904498F757 0x00007FF7475B5148 0x000000904498FB38 0x000000904498FA08)
0x00007FF74753F221 (0x0000021E01E30304 0x0000000000000022 0x0000021E038B69D0 0x000000904498F9C0)
0x00007FF74755DAA5 (0x0000021E038B6C00 0x0000021E038A09E0 0x0000000000000000 0x00007FFF33759D42)
0x00007FF74755CF60 (0x00007FFF57D784B8 0x000000904498FD6F 0x0000000000000000 0x007325203A6E6F69)
0x00007FF74756195E (0x0000021E01E3B638 0x0000021E01E3B620 0x0000000000000002 0x0000000000000000)
0x00007FF747560ED9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF74759599C (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FFF57EB4034 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFF5AA83691 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
Tagsdebug, debugger, lldb
Fixed in Revision
Attached Files



2019-08-04 22:56

reporter   ~0117563

May be important: The crash occurs only in methods. If it stops on breakpoint in a regular routine the result of examining procedural type variable:
error: Couldn't materialize: couldn't get the value of variable PROC: Unable to determine byte size.

Jonas Maebe

2019-08-04 23:08

manager   ~0117564

Try compiling with -godwarfcpp


2019-08-04 23:12

reporter   ~0117565

With this option it crashes as well.

Jonas Maebe

2019-08-04 23:16

manager   ~0117566

Please at least also file a bug report against lldb


2019-08-06 23:43

reporter   ~0117584


Jonas Maebe

2019-08-07 08:52

manager   ~0117586

Thanks. I noticed you mentioned that you use FPC 3.0.2 in the lldb bug report, while you mention FPC 3.0.4 here. Which one is correct?


2019-08-07 23:09

reporter   ~0117588

There should be 3.0.4. But the same behaviour is observed for 3.0.0 and 3.02.

Jonas Maebe

2019-08-09 17:41

manager   ~0117615

Last edited: 2019-08-09 17:49

View 2 revisions

lldb-350.0.21.9 (the lldb included with Xcode 8.1) does not crash. Unlike you, I don't get "unable to determine byte size" either. It simply doesn't print the field. You have to use -godwarfcpp for lldb to print anything at all though, because at some point someone started on adding Pascal support, but never finished it and in the end it completely broke debugging when the language in the debug information is set to Pascal (maybe that's been fixed in more recent versions though).

In any case, it's a regression in lldb.


2019-08-10 19:57

reporter   ~0117623

OSX versions of LLDB are much more stable and do not crash. This is because OSX is the primary platform for LLDB. But a procedural field is confusing for LLDB in any case.
I'd not count on a fix for this from LLDB side unless this affect some C++ type.

Jonas Maebe

2019-08-10 20:13

manager   ~0117626

It may help to get the bug fixed more quickly if you attach a compiled program to their bug report, so they don't have to install FPC.

Issue History

Date Modified Username Field Change
2019-08-04 22:45 George New Issue
2019-08-04 22:56 George Note Added: 0117563
2019-08-04 23:08 Jonas Maebe Note Added: 0117564
2019-08-04 23:10 George Tag Attached: debug
2019-08-04 23:10 George Tag Attached: debugger
2019-08-04 23:10 George Tag Attached: lldb
2019-08-04 23:12 George Note Added: 0117565
2019-08-04 23:16 Jonas Maebe Note Added: 0117566
2019-08-06 23:43 George Note Added: 0117584
2019-08-07 08:52 Jonas Maebe Note Added: 0117586
2019-08-07 23:09 George Note Added: 0117588
2019-08-09 17:41 Jonas Maebe Note Added: 0117615
2019-08-09 17:49 Jonas Maebe Note Edited: 0117615 View Revisions
2019-08-10 19:57 George Note Added: 0117623
2019-08-10 20:13 Jonas Maebe Note Added: 0117626