[Lazarus] GDB strangeness
Michael Van Canneyt
michael at freepascal.org
Tue Aug 25 19:03:10 CEST 2015
On Tue, 25 Aug 2015, Martin Frb wrote:
> On 25/08/15 11:06, Michael Van Canneyt wrote:
>>
>> I'm debugging a program, and it just won't debug inside lazarus.
>>
>> When I look at the debug output in Lazarus, I see:
>>
>> <-exec-run>
>> =thread-group-started,id="i1",pid="20658"
>> =thread-created,id="1",group-id="i1"
>> ^running
>> *running,thread-id="all"
>> (gdb) =thread-exited,id="1",group-id="i1"
>> =thread-group-exited,id="i1"
>> ^error,msg="During startup program exited with code 1."
>>
>> The strange thing is that if I use gdb on the command-line, it does start
>> and run the program,
>> and I can debug as I would expect it (albeit very rudimentary).
> lazarus tries to set a break at entrypoint, and once that is reached it will
> set user breaks.
>
> the last line/error is from the IDE, because that entry point brk was not
> reached.
>
> 2 possible solutions:
> - a library interfers with the name "main". there is an option
> (tools/options/ debugger) to skip loading dll info
> http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#internal-error:_clear_dangling_display_expressions
> - tools/options/ debugger change the InternalStartBreak option
After a lot of testing, I tracked it to the run command-line I was using.
It contains ? and other characters in need of escaping.
While I was using the exact same command-line on the console and in lazarus, there was a difference.
It has to do with the way gdb parses the arguments. It apparently uses the shell to expand the arguments to a program.
Which shell it uses depends on the environment.
I use tcsh as my shell, and apparently lazarus lets gdb use another shell.
Maybe adding an explicit command may help, there seems to be:
set startup-with-shell
For me, I fixed it by properly escaping the run command, and then all went well.
It took me quite some time to find out :(
Hopefully people will learn from my experience :)
Michael.
More information about the Lazarus
mailing list