Cannot make sense of lldb lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- AL · 2020-02-22 02:39 I just installed FPC 3.3.1 and Laz 2.1.0 on a VM-Mac OS 10.14 Mojave I have set the lldb debugger in the preferences. The debugger does not stop on break point I have set. But it give me a debugger error. Could it be a bad installation? I have installed Xcode and the command line tools. From the name : I386GPFLT  could it a debugger for 386 ? ---------------------------------------------------------------------- lucamar · 2020-02-22 11:34 I386GPFLT means "General Protection Fault". Looks like something is trying to access memory it doesn't own. ---------------------------------------------------------------------- AL · 2020-02-22 14:02 yes but this is the I386 that bothers me. I am on 64 bits Cocoa ---------------------------------------------------------------------- lucamar · 2020-02-22 14:51 IIRC (and I may not: I'm no expert with lldb) the "I386" is meant to signal an Intel PM-capable processor, of which the first was the iAPX 80386. Note that GP faults are old-style exceptions and have been there from the beginning (the 386; the 286 had a similar trap but it worked differently). ---------------------------------------------------------------------- wp · 2020-02-22 18:02 The situation with the debuggers is a bit confusing, also to me. Since Martin is not around at the moment, and since I also installed a Lazarus trunk on Mac Mojave recently I want to share my configuration which seems to be working: Are the packages fpdebug and lazdebuggerfplldb installed?In the menu "Preferences" > "Debugger" > "Debugger backend", the combo "Debugger type and path" displays "LLDB debugger (with FPDebug) (Beta)". The path combo underneath displays "lldb" - there is another option "usr/bin/lldb" which I did not testI had some errors due to GDB still, and found out that it helps to check the option "SkipGDBDetection" in the "Debugger specific options" below.I did not check the other LLDB debugger (package "lazdebuggerlldb" which is marked as "alpha". ---------------------------------------------------------------------- AL · 2020-02-22 18:51 In Preferences / Debuggerbackend I have only LLDB Debugger Alpha which is in /Library/Developer/CommandLineTools/usr/bin/lldb Strangely, the exact name is (2) LLDB Debugger Alpha I also have GDB (3 options) I checked the path for Lldb and it is good. However there is another one (lldb) in Xcode.app/contents/Developer/usr/bin The xcode-select --install,  point to this second installation The installed debugger packages are: CmdLineDebuggerBase DebuggerIntf fpDebug LazDebuggerGDBmi LazDebuggerLldb NOT installed are: LazdebuggerFp LazDebuggerfpdserver LazDebuggerfpgdbmi LazDebuggerfplldb Should I de-install all gdb related packages? ---------------------------------------------------------------------- AL · 2020-02-22 20:06 I set the packages like WP said, still the same. I set break points in my code and the debugger do not stop at them, so I cannot step in the code and see where the error occur. I made sure the breakpoints were way before the error. I will try the debugger with one of the example programs. ---------------------------------------------------------------------- wp · 2020-02-22 22:43 Quote from: AL on February 22, 2020, 09:06:37 pmI set break points in my code and the debugger do not stop at them, so I cannot step in the code and see where the error occur. I usually have this observation, also on Windows, when the checkbox "Generate info for the debugger" in the Compiler Options is not set. And I noticed: In the Project Options of trunk, there is a Debugger Backend combobox now as well, I guess it overrides the IDE-wide debugger settings. ---------------------------------------------------------------------- AL · 2020-02-22 23:03 Have was not aware of the project debugger backend. It was set differently from the IDE.  It was set to LLDB Debugger (ALpha) I tried to set it to "LLDB debugger (with FPDebug) (Beta)" but it would not keep it. I then set it to "Use IDE debugger". Now I have a new warning form the debugger (See attached). It still does not stop at the break points but this may be due to this error. I have no idea what it is talking about ! ---------------------------------------------------------------------- AL · 2020-02-22 23:17 I have erased the dyn file and now that error is gone. Still not stopping on my break points! ---------------------------------------------------------------------- trev · 2020-02-23 12:38 Quote from: AL on February 23, 2020, 12:03:29 amI tried to set it to "LLDB debugger (with FPDebug) (Beta)" but it would not keep it. I then set it to "Use IDE debugger". I struck that too. "Use IDE debugger" was the curious fix. QuoteIt still does not stop at the break points [...] I can't test at the moment as I'm interstate for a few days for owners corporation meetings. I'll test on my return if no-one else has beaten me to it. ---------------------------------------------------------------------- Martin_fr · 2020-02-23 13:48 Quote from: AL on February 22, 2020, 07:51:33 pmLazDebuggerfplldb Should I de-install all gdb related packages? That one needs to be installed, and "LLdb with fpdebug" should then be in the list. Not sure if that will solve the issue... 1) Your app does not crash outside the debugger? 2) Does it crash (in the debugger) during start app (before any form is shown). Or does it crash once the form is show (on user action)? 3) Does it crash (in the debugger) if you do not set any breakpoint, and let it just run? ---------------------------------------------------------------------- AL · 2020-02-23 13:56 This is very strange.  My program runs fine on windows. I use TaChart. Without the debugger , my app crash during some Addxy, but never on the same point ( I have 4000 points to chart). With the debugger it crash almost on startup. But I have seen something which may be related.  During compilation there are a lot of "file not found" displayed in the message window, but this goes fast and I cannot see what it is exactly.  Also these messages do not stay in the message box, they are overwritten by new ones.  This may be related to the fact that I have a "space" in my folder name where my project is. (I copied that from a Windows Env).  I will rename my folder and see what happens. Is there a way to make the compiler stop on these errors? ---------------------------------------------------------------------- AL · 2020-02-23 14:01 removing the space did not help. I could see the name of some of the 'not found' files. Mailny pp and ppu related to the system and cocoa. I will make a new fpcUpDeluxe installation. ---------------------------------------------------------------------- AL · 2020-02-23 14:53 New installation did not help also. Still report of files not found, but the compiler does not stop ?  And give a success st the end. I will try to set my VM slower so I can read the missing files. ---------------------------------------------------------------------- Martin_fr · 2020-02-23 15:03 Right click the message window, and find the menu entry: Copy => Copy all and original messages. Then paste into an editor of your choice. ------- Make sure to compile with "dwarf", not "stabs": Project Options > Debug info Make sure you compile with range checks and all : -Criot Also try with/without "heaptrc" -gh. On Windows, test your app with -gt  and also -gtt  or -gttt   (1 to 3 t) (helps sometimes to detect uninitialized vars) When your app crashes: 1) See if you can find anything by using the Stack window. Any callers may be useful. 2) Before pressing F9/Run go to menu: View > Ide internals (on some versions "Debug windows" instead) > Debug output.   This should print raw communications between the IDE and lldb. Copy, and paste in this topic. ---------------------------------------------------------------------- AL · 2020-02-23 23:24 Thank you Martin. Using the copy all originals I could see that the compiler is scanning may be 20 directories and reporting Not Found on each until it scan the RTL and then indicate  FOUND. So this was not the problem. I have noticed a strange behavior.  I changed the caption of a button on the form .  It did change on the build screen and in the .lfm file BUT it did not changed in the executable file. This mean to me that the compiler /liker is taking the file somewhere else. I tried to see where that could be and did not find it. There are 3 subdirectories from differents targets ( i386-Win 32 , X86_64-Win64, X86_64-Darwin) I notices there are lfm and pas files there also. While I was writing this, I remembered that when cross-compiliing from Windows the executable is not updated in the app folder. I was sure that in Darwin it would be, since the "Use App bundle for running and debugging" was checked. In fact it is not updated. ( Is this a bug ? Or a feature that could be implemented) This is why all the breaks points I was putting in the code were without effect. I wil make more tests but I think now the debugger should work. ---------------------------------------------------------------------- Martin_fr · 2020-02-24 10:13 Afaik on Mac the executable in the app bundle is a sym-link to the exe in the project dir (or something like that / not sure) Anyway if your form data *.lfm is not updated, that could be the cause of the crash. (And that crash would probably happen before any breakpoint can be reached). The lfm file is saved with your sources, but on compile copied to your lib folder (where the ppu go). If that fails there is a problem. Also if any compiled unit is not updated, then that can get you crashes. In the same manner, debug info may be outdated and then the translation between line-number and asm-code-address does not work, and breakpoint will not stop. The "not found" messages, are probably shown because you added some verbosity option (project options, or command line -v... / maybe -va) ------ First: Did you (in project options) on the page "Paths" change any of the path settings? If you did, that is most certainly the cause of your issue. Those settings are truly advanced, and every so often someone runs into trouble. Check your project folder for any *.ppu and *.o files. Unless you deliberated copied something in (from a 3rd party closed source package), you can delete then and should do so. There is a "clean up and build" menu entry, that should allow you to get rid of them. The correct ones will then be build. ---------------------------------------------------------------------- wp · 2020-02-24 10:42 Quote from: AL on February 24, 2020, 12:24:39 amThere are 3 subdirectories from differents targets ( i386-Win 32 , X86_64-Win64, X86_64-Darwin) I know that you have the Mac on a VM using a Windows host. Does this mean that you share your Windows project folder with the Mac VM? Are you sure that Mac has permissions to write on Windows? For a test, copy the project to the Mac-VM and work with the copy only. Make sure that you are the owner of the copied files and have all permissions needed (I know from my own (little) experience with Mac that this is critical). ---------------------------------------------------------------------- AL · 2020-02-24 13:57 Thanks all for your help.  I am making progress (slowly). My windows project folder is copied to the VM-Mac desktop so permissions should be OK there. I have not changed any Paths ( the install was form FpcUpDeluxe) I do make "clean and Build" from time to time to make sure I have good compiled files. Since I copy manually  (at each build) the executalble in the app folder, things run more normally. I think, before doing that, I was running always the original executable and my changes and break points and forms changes seems they were not considered because of that. The debugger now runs since I installed the fpdebug package and use the lldb with fpdebug Beta. However I still get crash. I am using AudioQueue and this have a Callback procedure, I think the crashes are related to that.  Crashes are related to memory.  Sometimes  I have EStackOverflow ( although I increased the memory to 6 gig), sometimes Access violation, etc. One thing that bothers me is this warning I have when testing the complier options: How can I eliminate that? HINT: using config file /Users/al/Lazarus/fpc/bin/x86_64-darwin/fpc.cfg WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x 86_64-darwin/univint/Dialogs.ppu, /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x86_64-darwin/fv/dialogs.ppu WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x 86_64-darwin/univint/Menus.ppu, /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x86_64-darwin/fv/menus.ppu WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x 86_64-darwin/fv/dialogs.ppu, /Users/al/Lazarus/lazarus/lcl/units/x86_64-darwin/dialogs.ppu WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x86_64-darwin/fv/menus.ppu, /Users/al/Lazarus/lazarus/lcl/units/x86_64-darwin/menus.ppu WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x 86_64-darwin/univint/Controls.ppu, /Users/al/Lazarus/lazarus/lcl/units/x86_64-darwin/controls.ppu WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x 86_64-darwin/univint/Dialogs.ppu, /Users/al/Lazarus/lazarus/lcl/units/x86_64-darwin/dialogs.ppu WARNING: ppu exists twice: /Users/al/Lazarus/fpc/lib/fpc/3.3.1/units/x 86_64-darwin/univint/Menus.ppu, /Users/al/Lazarus/lazarus/lcl/units/x86_64-darwin/menus.ppu