Cannot debug on Linux lazarus / 12-Debugger ---------------------------------------------------------------------- Anonymous · 2005-11-15 21:30 Hello to all my Linux box is a Slackware 10.1 and I have installed Lazarus 0.9.10. When I try to run a project from the IDE, the debugger enter the error state. My settings are : use gdb (ver. 6.3) with /usr/bin/gdb as the path; the file /etc/fpc.cfg has the option -g enabled. After the error I look at the debugger window and the last lines are : (gdb) <-exec-run> ^running (gdb) &"Cannot exec : No such file or directory.\n" &"You can't do that without a process to debug.\n" ^error,msg="You can't do that without a process to debug." (gdb) &"info program\n" ~"The program being debugged is not being run.\n" ^done,reason="exited",exit-code="0177" (gdb) Please note that the executable file works correctly if launched from the shell. Also note that the previous Lazarus 0.9.8 worked fine on the same Linux box. Any idea about what I'm doing wrong ?[/quote][/code] ---------------------------------------------------------------------- Marc · 2005-11-16 09:49 In the same debugger window, do you see some lines where the filename is set ? ---------------------------------------------------------------------- VitFer · 2005-11-16 11:29 I'm not in front of my Linux box now but I don't remember such a line.  :cry: ---------------------------------------------------------------------- Marc · 2005-11-17 10:16 Strange. Did you try it with an empty new app (single form) saved on a path without spaces, with an unit and project name with a short lowercase name, only using lower ascii ? (just to exclude some possible problems) ---------------------------------------------------------------------- VitFer · 2005-11-17 21:16 Hi Marc sorry for the late reply. I've created a simple project, with an empty form and only the default code inside the unit. The problem is still the same so I've pasted the entire message in the debugger window. I hope this can help. <-gdb-set env PWD=/home/vitfer> ^done (gdb) <-gdb-set env QTDIR=/usr/lib/qt> ^done (gdb) <-gdb-set env SHELL=> ~"Setting environment variable \"SHELL\" to null value.\n" ^done (gdb) <-gdb-set env SHLVL=1> ^done (gdb) <-gdb-set env T1LIB_CONFIG=/usr/share/t1lib/t1lib.config> ^done (gdb) <-gdb-set env TERM=dumb> ^done (gdb) <-gdb-set env USER=vitfer> ^done (gdb) <-gdb-set env WINDOW_MANAGER=metacity> ^done (gdb) <-file-exec-and-symbols "/home/vitfer/test/project1"> ~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n" ^done (gdb) <-environment-cd "/home/vitfer/test/"> ^done (gdb) <-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC> &"No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context.\n" ^error,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context." (gdb) &"info functions FPC_CPUINIT\n" ~"All functions matching regular expression \"FPC_CPUINIT\":\n" ~"\n" ~"Non-debugging symbols:\n" ~"0x0805368c  SYSTEM_FPC_CPUINIT\n" ^done (gdb) <-gdb-set language pascal> ^done (gdb) <-break-insert -t main> ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr=" 0x080535b0",func="main",file="project1.lpr",line="11",times="0"} (gdb) <-break-insert FPC_RAISEEXCEPTION> ^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr= "0x0805ce72",at="",times="0"} (gdb) <-break-insert FPC_BREAK_ERROR> ^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr= "0x0805f4c2",at="",times="0"} (gdb) <-break-insert FPC_RUNERROR> ^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr= "0x0805f592",at="",times="0"} (gdb) &"info file\n" ~"Symbols from \"/home/vitfer/test/project1\".\n" ~"Local exec file:\n" ~"\t`/home/vitfer/test/project1', file type elf32-i386.\n" ~"\tEntry point: 0x8053490\n" ~"\t0x080480f4 - 0x08048107 is .interp\n" ~"\t0x08048108 - 0x08049368 is .hash\n" ~"\t0x08049368 - 0x0804bc38 is .dynsym\n" ~"\t0x0804bc38 - 0x0804f318 is .dynstr\n" ~"\t0x0804f318 - 0x0804f832 is .gnu.version\n" ~"\t0x0804f834 - 0x0804f884 is .gnu.version_r\n" ~"\t0x0804f884 - 0x0804f8c4 is .rel.dyn\n" ~"\t0x0804f8c4 - 0x08050ca4 is .rel.plt\n" ~"\t0x08050ca4 - 0x08050cbe is .init\n" ~"\t0x08050cc0 - 0x08053490 is .plt\n" ~"\t0x08053490 - 0x081a8700 is .text\n" ~"\t0x081a8700 - 0x081a871e is .fini\n" ~"\t0x081a8720 - 0x081a8724 is .eh_frame\n" ~"\t0x081a9000 - 0x081a9008 is .ctors\n" ~"\t0x081a9008 - 0x081a9010 is .dtors\n" ~"\t0x081a9010 - 0x081a9014 is .jcr\n" ~"\t0x081a9014 - 0x081a9124 is .dynamic\n" ~"\t0x081a9124 - 0x081a9128 is .got\n" ~"\t0x081a9128 - 0x081a9b24 is .got.plt\n" ~"\t0x081a9b24 - 0x0823d850 is .data\n" ~"\t0x0823d850 - 0x08253e48 is .bss\n" ^done (gdb) <-exec-run> ^running (gdb) &"Cannot exec : No such file or directory.\n" &"You can't do that without a process to debug.\n" ^error,msg="You can't do that without a process to debug." (gdb) &"info program\n" ~"The program being debugged is not being run.\n" ^done,reason="exited",exit-code="0177" (gdb) What do you think about the message "No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context.\n" ? Thank you very much for your help ---------------------------------------------------------------------- Marc · 2005-11-18 10:37 I am puzzeled. Here a breakdown: Quote <-gdb-set env PWD=/home/vitfer> ^done (gdb) <-gdb-set env QTDIR=/usr/lib/qt> ^done (gdb) <-gdb-set env SHELL=> ~"Setting environment variable \"SHELL\" to null value.\n" ^done (gdb) <-gdb-set env SHLVL=1> ^done (gdb) <-gdb-set env T1LIB_CONFIG=/usr/share/t1lib/t1lib.config> ^done (gdb) <-gdb-set env TERM=dumb> ^done (gdb) <-gdb-set env USER=vitfer> ^done (gdb) <-gdb-set env WINDOW_MANAGER=metacity> ^done (gdb) Set some environmentvars: OK Quote <-file-exec-and-symbols "/home/vitfer/test/project1"> ~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n" ^done (gdb) Set the exe name: it loads, mit is recognized as exe, OK Quote <-environment-cd "/home/vitfer/test/"> ^done (gdb) Set working dir: OK Quote <-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC> &"No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context.\n" ^error,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context." (gdb) &"info functions FPC_CPUINIT\n" ~"All functions matching regular expression \"FPC_CPUINIT\":\n" ~"\n" ~"Non-debugging symbols:\n" ~"0x0805368c  SYSTEM_FPC_CPUINIT\n" ^done (gdb) Try to find out what version of FPC this exe was build with (does it pass parameters by regs): OK Quote <-gdb-set language pascal> ^done (gdb) We're talking pascal: OK Quote <-break-insert -t main> ^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr=" 0x080535b0",func="main",file="project1.lpr",line="11",times="0"} (gdb) <-break-insert FPC_RAISEEXCEPTION> ^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr= "0x0805ce72",at="",times="0"} (gdb) <-break-insert FPC_BREAK_ERROR> ^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr= "0x0805f4c2",at="",times="0"} (gdb) <-break-insert FPC_RUNERROR> ^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr= "0x0805f592",at="",times="0"} (gdb) Set some internal breakpoints to catch exceptions, runtime errors etc. They are found, so we have some debug symbols: OK Quote &"info file\n" ~"Symbols from \"/home/vitfer/test/project1\".\n" ~"Local exec file:\n" ~"\t`/home/vitfer/test/project1', file type elf32-i386.\n" ~"\tEntry point: 0x8053490\n" I Only need these two lines: OK Quote <-exec-run> ^running (gdb) &"Cannot exec : No such file or directory.\n" &"You can't do that without a process to debug.\n" ^error,msg="You can't do that without a process to debug." (gdb) Eeehhh !?!?!?!? It successfully loads, but it cannot run. Did you try to run the exe itself from a command shell? And can you try to run the exe in gdb itself: Code: [Select]gdb /home/vitfer/test/project1 run Quote &"info program\n" ~"The program being debugged is not being run.\n" ^done,reason="exited",exit-code="0177" (gdb) It somehow exited before it hit the main entry point. Quote What do you think about the message "No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context.\n" ? It is a way to detect what version of FPC is used to build the exe, so it is possible that it can't be found (but afair fpc 2.0 should have it, I need to check my checks) ---------------------------------------------------------------------- VitFer · 2005-11-18 10:58 Hi Marc yes I've tried the exe itself and it runs ok. I'll try to run it using gdb from the shell asap. Bye for now ---------------------------------------------------------------------- VitFer · 2005-11-18 12:47 Tried to run the exe from gdb : it print on screen the same error message. It seems gdb cannot run any exe build with Lazarus, neither 0.9.8 nor 0.9.10. The stange thing is that 0.9.8 did work well with the debugger. I want to reinstall 0.9.8 and check again. Bye ---------------------------------------------------------------------- Marc · 2005-11-21 10:25 I don't think reinstalling fpc will help. Does gdb give any error or warning ? and does gdb work on another exe (like /bin/ls) ? ---------------------------------------------------------------------- VitFer · 2005-11-21 13:07 Hi Marc you're right : nothing is changed with a new installation of 0.9.8. I tried to run the executable using gdb from the shell and it didn't work (it always returned the same error). I'll try to run other executables asap. Bye ---------------------------------------------------------------------- SergKam · 2005-11-21 16:16 fpc 2.1.0 genereate erorr debug info for gdb. try FPC 2.0. ---------------------------------------------------------------------- VitFer · 2005-11-21 17:47 I'm using fpc 2.0.0 . I've never upgraded it. ---------------------------------------------------------------------- VitFer · 2005-11-22 06:58 What do you think about gdb 6.3 ? I guess I used Lazarus 0.9.8 with Slackware 10.0 that installed gdb 6.1.1. Now I'm not able to use gdb at all, with any kind of executable. The error is always the same : No such file or directory and error code 0177. Any idea ? ---------------------------------------------------------------------- VitFer · 2005-11-28 20:24 OK guys, the problem is fixed now. My environment variable $SHELL was empty  :roll: I've modified my .profile adding the line export SHELL=/bin/sh That's all Bye ---------------------------------------------------------------------- Marc · 2005-11-29 10:53 Wierd  :?: Anyhow, glad that it works ---------------------------------------------------------------------- VitFer · 2005-11-29 14:55 Google rulez I found the solution watching at LinuxQuestion.org  :mrgreen: Bye