Debugger broken in Yosemite lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- Daniello · 2015-05-01 19:11 I got a new Macbook, with Yosemite (before I was using Lion) and the debugger in Lazarus no longer works  I followed the instructions from here http://wiki.lazarus.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5 When launch Lazarus and run my app I get a popup asking for inserting a password. I insert, the program runs, but no breakpoints trigger. After I stop the program, I get 2 or 3 Lazarus popups with debugger error message ("something wrong happened"). ---------------------------------------------------------------------- Martin_fr · 2015-05-01 19:28 Have you checked those steps of your setup http://wiki.lazarus.freepascal.org/Debugger_Setup Ensure to use dwarf. You may have to chekc *every* package, since every package can have its own options. Can you run gdb form the console? /path/to/gdb /path/to/yourproject.app/Contents/MacOS/yourproject then in gdb enter "r" (without the quotes) and hit return. What are the errors? ---------------------------------------------------------------------- kamischi · 2015-05-01 20:00 As much as I know, Xcode on Yosemite has only lldb and no gdb. I have no experience, whether and if so how well lldb works. gdb can still be installed through fink in an older version with apple-hacks and a recent version without apple-hacks. Michael. ---------------------------------------------------------------------- Daniello · 2015-05-01 20:07 kamishi, in the link I posted to the lazarus wiki there's a tutorial how to get gdb in latest OSX, I had followed it before. Martin_fr, thanks for the link, I double checked everything, there was only one thing missing in my project settings, I changed debug info from 'automatic' to 'dwarf with sets' and now breakpoints work! If someone from Lazarus team reads this,  I suggest checking what's the problem with the 'automatic' settings in OSX. ---------------------------------------------------------------------- Martin_fr · 2015-05-01 21:08 Automatic actually means "fpc default" So it seems at least in fpc 2.6.4 that is still stabs on OSX. The general problem is known, and some sort of better feedback or setting in the IDE will be needed. Not sure how soon we will be able to provide this. ---------------------------------------------------------------------- kamischi · 2015-05-01 21:55 Quote from: Martin_fr on May 01, 2015, 11:08:14 pmAutomatic actually means "fpc default" So it seems at least in fpc 2.6.4 that is still stabs on OSX. The general problem is known, and some sort of better feedback or setting in the IDE will be needed. Not sure how soon we will be able to provide this. The fink package description of lazarus has an according patch of ide/compileroptions.pp. Here it is: # change Debug format from stabs to dwarf    sed -i.bak "s|GenerateDwarf/Value', false|GenerateDwarf/Value', true|g" ide/compileroptions.pp ---------------------------------------------------------------------- VTwin · 2015-06-12 13:42 I just installed Yosemite 10.10.3 and am still having some issues running gdb in Lazarus 1.4.0. I used Homebrew to install gdb 7.9.1, and set "Type of debug info" to "Dwarf with sets". The debugger is stopping at breakpoints, but when I stop the program I get a "GDB has encountered an internal error" message, and then a "Debugger error" message. Any additional information on how to fix this would be greatly appreciated. Cheers, VTwin ---------------------------------------------------------------------- kamischi · 2015-06-12 13:49 Code signing might be the problem. Check the wiki for how to code signing gdb. ---------------------------------------------------------------------- VTwin · 2015-06-12 13:55 Thanks kamischi, I did follow the code signing wiki, and it seemed to run in the terminal after, so I think I did it right. Code: [Select]GNU gdb (GDB) 7.9.1 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin14.3.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) VTwin ---------------------------------------------------------------------- VTwin · 2015-06-12 14:02 I did notice that "Dwarf with sets (-gw -godwarfsets)" actually generates -gw2 -godwarfsets. Trying "Automatic (-g)" and adding -gw in "Additions and Overrides" did not make a difference. Trying Dwarf2 (-gw2) did not make a difference. ---------------------------------------------------------------------- Martin_fr · 2015-06-12 14:29 Quote from: VTwin on June 12, 2015, 03:42:26 pmThe debugger is stopping at breakpoints, but when I stop the program I get a "GDB has encountered an internal error" message, and then a "Debugger error" message. If the debugger stops at breakpoints, and by implication it launches your exe, then 1) yes codesigning is ok 2) at least the code/unit in which it stops at breakpoints uses dwarf "internal error" Some version of gdb do that. This indicates a bug in gdb. A few common possibilities (though most have been encountered on windows, it is possible that it applies to other platforms too.) 1) Try DisableLoadSymbolsForLibraries http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#internal- error:_clear_dangling_display_expressions 2) My own tests have shown that GDB 7.8.x does crash more often than 7.7.1. I have not tested 7.9.x yet. You may whish to try and build a version 7.7.1 GDB 3) You can supply a logfile http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debu g_session This may (or may not) reveal any clue into what is happening ---------------------------------------------------------------------- VTwin · 2015-06-12 14:56 Martin, I set "DisableLoadSymbolsForLibraries" to "True", but that did not make a difference. I will try to figure out how to build GDB 7.7.1 Thanks, VTwin ---------------------------------------------------------------------- VTwin · 2015-06-12 16:55 Thanks, I seem to have it running. For anyone running into this, here are some tips that worked for me: Upgrade to Xcode 6.3.2. Install the Apple version of GDB gdb-apple using MacPorts. I followed directions here: http://ntraft.com/installing-gdb-on-os-x-mavericks/ This appears to be GNU gdb 6.3.50. You can ignore the warning about the Yosemite patch, it seems to be fixed. I also installed apple- gcc42, which may not be necessary. I certified it following the instructions there, except I named it "gdb-apple-cert", and set the validity period to "3650". Finally, in Lazarus I set the debugger path to "/opt/local/bin/gdb- apple" ---------------------------------------------------------------------- Martin_fr · 2015-06-12 18:47 Note that the "apple" gd 6.3.50 is not bug free either (but no gdb version is) The IDE by default gives warnings in some situations that are caused by the 6.3.50. You can disable them in the options, by setting  "WarnOnTimeOut" to False. You can also set "TimeOutForEval" to 50. Background: gdb does not print the prompt " (gdb)" for the next command. The reason for his is not known. But probably an internal error in GDB. Yet so far everyone who had this, reported that it did *not* cause any problems for the rest of the debug session. So the IDE has to guess (actually it performs some tests to establish the correct state) I also recommend to check the option "Reset debugger after each run" (This may slightly increase the time F9 needs to start your app)