Strange error on OS X causing debugger error lazarus / 13-General ---------------------------------------------------------------------- MISV · 2015-09-06 23:42 After coming back to my OS X project I suddenly always get Quote"Debugger error.... Stop and hope for he best, we're pulling the plug' message (not exact words but close) In details I get this: QuoteFailed to load application execuable "/Volumns.../path/mylazarus.app/Contents/MacOS/mylazarus": not in executable format: File format not recognized Here comes the kicker though... If I move the core executable file  "mylazarus" into my own .app file it runs fine without problems. ---------------------------------------------------------------------- Martin_fr · 2015-09-07 10:33 Well the error you see comes from gdb. And not sure what gdb dislikes. If you are interested, you can use the: Menu: View > Debug Windows > Debug Output to see more of the gdb conversation. or http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_d ebug_session The IDE first tries to send app (i.e. the folder) to gdb. But afaik no version of gdb (except maybe the old one that apple shipped) can deal with this. Then the IDE sends the path to the exe inside the folder. The latter used to work. No idea why it does not work for you. Maybe (afaik) the IDE creates a symlink by default, not sure if that is recognized by gdb? But then no idea how to solve it (Maybe you can go to project options, and specify a location for the generated exe, so you do not need to move it) ---------------------------------------------------------------------- MISV · 2015-09-08 08:14 There appears to be an error reported just before "Inappropriate ioctrl for device" - I will post complete log later after trying some things ---------------------------------------------------------------------- MISV · 2015-09-08 09:44 So far unsuccessful at resolving the problem - trying different things right now like recreaing the project etc. Here's debugger log: Code: [Select]=thread-group-added,id="i1" (gdb) <-gdb-set confirm off> ^done (gdb) <-gdb-set new-console off> ^error,msg="No symbol table is loaded.  Use the \"file\" command." (gdb) &"set width 50000\n" =cmd-param-changed,param="width",value="50000" ^done (gdb) <-gdb-version> ~"GNU gdb (GDB) 7.8.1\n" ~"Copyright (C) 2014 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later \nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-apple-darwin14.0.0\".\nType \"show configuration\" for configuration details." ~"\nFor bug reporting instructions, please see:\n" ~".\n" ~"Find the GDB manual and other documentation resources online at:\n.\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\".\n" ^done (gdb) <-gdb-set env TMPDIR=/var/folders/1f/bnsnksrs1nx2yztm33d36l1h0000gn/T/> ^done (gdb) <-gdb-set env __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0> ^done (gdb) <-gdb-set env SHELL=/bin/bash> ^done (gdb) <-gdb-set env HOME=/Users/myname> ^done (gdb) <-gdb-set env Apple_PubSub_Socket_Render=/private/tmp/com.apple.launch d.RFNY1ZGdsq/Render> ^done (gdb) <-gdb-set env SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.34Vd1AMPMu/Listeners> ^done (gdb) <-gdb-set env PATH=/usr/bin:/bin:/usr/sbin:/sbin> ^done (gdb) <-gdb-set env LOGNAME=myname> ^done (gdb) <-gdb-set env XPC_SERVICE_NAME=lazarus.freepascal.ide.58820> ^done (gdb) <-gdb-set env USER=myname> ^done (gdb) <-gdb-set env XPC_FLAGS=0x0> ^done (gdb) <-file-exec-and-symbols "/Volumes/DiskW/projects- cool/MyProject/compiled/MyProjectLazarus.app"> ^error,msg="/Volumes/DiskW/projects- cool/MyProject/compiled/MyProjectLazarus.app: Inappropriate ioctl for device." (gdb) <-file-exec-and-symbols "/Volumes/DiskW/projects-cool/MyProject/compil ed/MyProjectLazarus.app/Contents/MacOS/MyProjectLazarus"> ^error,msg="\"/Volumes/DiskW/projects-cool/MyProject/compiled/MyProjec tLazarus.app/Contents/MacOS/MyProjectLazarus\": not in executable format: File format not recognized" (gdb) ---------------------------------------------------------------------- Martin_fr · 2015-09-08 10:34 I cant test on Mac myself right now, so I relay on memory and feedback. Is it (still) correct, that foobar/MyProjectLazarus.app/Contents/MacOS/MyProjectLazarus is a symlink to foobar/MyProjectLazarus ? If so, then I can only assume that gdb does not support symlinks. Yet giving the exe outside the folder to gdb is not an option. IIRC any app on Mac that is run outside its bundle will dis-behave. So then the only option is to get rid of that symlink. For a quick solution, in the project options is a setting to specify the exe name. IIRC you can specify that location to be inside the bundle. If that is solving it then maybe this needs to be changed as a new default. In that case report a bug, but NOT against debugging. report it as a compilation issue. ---------------------------------------------------------------------- MISV · 2015-09-08 11:19 Hi Martin, Right now, it acually appear to have been improved - but this is very preliminary (!) I went into "Run | Run Paramaters...." and in "Host application" passed it: /Volumes/DiskW/projects-cool/MyProject/compiled/MyProjectLazarus (i.e. the core executable) Runtime, I have code that checks for data files using multiple test paths (if running in or ouside .app) after which it adjusts I am slightly puzzled as to why my solution works though... Since I would expect Lazarus to "autofill" this path in. "Host application" was empty before I filled in the path. However, on the downside, my app can not gain focus... (i.e. can' select any control with the mouse or anyhing) so as such, I am only a little closer to a solution ---------------------------------------------------------------------- Martin_fr · 2015-09-08 11:34 You posted the cross link in the other forum, so it is enough to reply in one of the two. Since discussion is on in this thread now, please do not duplicate in the other. Not sure (but watch the gdb output). Setting host app, as you did, points to the exe outside the bundle. So this is different path from what the debugger does. However, afaik, using an exe outside the bundle (for GUI apps) will cause strange effects, such as inability to focus by mouse.... Have you tried "Project Options" ? select "Compiler Options > Path", and change "Target file name" to MyProjectLazarus.app/Contents/MacOS/MyProjectLazarus ---------------------------------------------------------------------- MISV · 2015-09-09 08:46 Okay - right now I have done the following: In "Run | Run Paramaters...." and in "Host application" I am passing it /Volumes/DiskW/projects-cool/MyProject/compiled/MyProjectLazarus.app/C ontents/MacOS/MyProjectLazarus In "Project options" "Paths" Target file name (-o) compiled/MyProjectLazarus.app/Contents/MacOS/MyProjectLazarus And itt appears to work! Crossing fingers it will continue to do so - I will report back