[Lazarus] Lazarus cannot debug after Raspbian upgrade

Bo Berglund bo.berglund at gmail.com
Sat Jul 30 07:43:40 CEST 2016

On Sat, 30 Jul 2016 03:54:32 +0100, Martin Frb <lazarus at mfriebe.de>

>On 29/07/2016 21:59, Bo Berglund wrote:
>> On Fri, 29 Jul 2016 14:45:22 +0100, Martin Frb <lazarus at mfriebe.de>
>> wrote:
>>> On 29/07/2016 14:31, Bo Berglund wrote:
>>>> The GDB command:
>>>> "-gdb-set confirm off"
>>>> did not return any result.
>>> what happens (does gdb return a prompt " (gdb)" for the next commad?),
>>> if you run (by hand)
>>>    gdb -i mi
>>> and then enter
>>>    -gdb-set confirm off
>>> what if you alternatively enter
>>>    set confirm off
>> All of these suggestions do not really mean anything to me. Can you be
>> more specific?
>> I have never used gdb by itself, I assume it is used by Lazarus to
>> handle the breakpoints I set in teh source code, but HOW that is done
>> is way beyond me.
>Can you open a shell or terminal, and in it enter
>gdb -i mi
>(and then return)
>gdb will print some message, and then let you enter gdb commands.
>-gdb-set confirm off
>(and then return)
>copy the output.
>to exit gdb

pi at rpi3-jessie:~ $ gdb -i mi
~"GNU gdb (Raspbian 7.7.1+dfsg-5) 7.7.1\n"
~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\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 \"arm-linux-gnueabihf\".\nType \"show
configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"Find the GDB manual and other documentation resources online
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
-gdb-set confirm off

>This is just to be on the save side. I expect this will work with no 
>error, in which case  there is no easy way to find the problem....

No error visible....

>>> Sounds like a bug in gdb.
>>> what is in the "debug output" window? (open the window BEFORE pressing F9)
>> This is what I get:
>> =thread-group-added,id="i1"
>> (gdb)
>> <-gdb-set confirm off>
>> &"//\n"
>> &"Undefined command: \"\".  Try \"help\".\n"
>> 437^error,msg="Undefined command: \"\".  Try \"help\"."
>> (gdb)
>> <kill>
>Depends on what output you get from the above: run gdb yourself...
>Assuming that this does not give any error (it probably will be fine), 
>then the bug could be anywhere.
>what else did you upgrade? Lazarus? FPC?

I only did:
sudo apt-get update
sudo apt-get dist-upgrade

and then I ran

sudo rapi-config

so I could activate the GPIO server, which is the new item I needed
and was added in the latest Raspbian release.

After a reboot the error started to appear in Lazarus.

> From the code in components\lazdebuggergdbmi\cmdlinedebugger.pp
>>     DoDbgOutput('<' + ACommand + '>');   // this causes the log in the 
>> debug output, the ACommand is correct here
>>     if ACommand <> ''
>>     then FDbgProcess.Input.Write(ACommand[1], Length(ACommand));
>>     // store LineEnding in local variable, so the same statement can 
>> be used
>>     // for windows and *nix (1 or 2 character line ending)
>>     LE := LineEnding;                  // this hopefully is a lineend 
>> \n (gdb output suggest it got a line end)
>>     FDbgProcess.Input.Write(LE[1], Length(LE));
>But it seem gdb did not get the command, it got "//" instead.
>the "&" in the text, is gdb echoing back what it got.
>I have no idea where that could have been lost/changed.... (assuming I 
>interpret this correct)
>I dont know if some of those could be caused by changes in fpc.
>if I remember correctly fpc TProccess may start a terminal/shell. Maybe 
>there is a change there?
>Do you have a pstree (or use ps with parent pid), to see the parent of 
>gdb process?

I did this:
- In Lazarus I started the debug session and got the pop-up error.
- leaving the pop-up unconfirmed I used the terminal via PuTTY and ran

pi at rpi3-jessie:~ $ pstree
        ¦                    +-{gvfs-afc-volume}]
        ¦                    +-{gmain}]
        ¦               +-{gvfs-fuse-sub}]
        ¦               +-2*[{gvfsd-fuse}]]
        ¦             +-{gmain}
        ¦             +-{gmain}
        ¦             +-{pool}
        ¦         ¦      +-{llvmpipe-1}
        ¦         ¦      +-{llvmpipe-2}
        ¦         ¦      +-{llvmpipe-3}
        ¦         +-lightdm---lxsession---lxpanel---{gdbus}
        ¦         ¦         ¦           ¦         +-{gmain}
        ¦         ¦         ¦           ¦         +-{menu-cache-io}
        ¦         ¦         ¦           +-lxpolkit---{gdbus}
        ¦         ¦         ¦           +-openbox
        ¦         ¦         ¦           +-pcmanfm---{gdbus}
        ¦         ¦         ¦           ¦         +-{gmain}
        ¦         ¦         ¦           +-ssh-agent
        ¦         ¦         ¦           +-{gdbus}
        ¦         ¦         ¦           +-{gmain}
        ¦         ¦         +-{gdbus}
        ¦         ¦         +-{gmain}
        ¦         +-{gdbus}
        ¦         +-{gmain}
        ¦                +-{gmain}]
        ¦         +-{gmain}
        ¦          +-{in:imuxsock}
        ¦          +-{rs:main Q:Reg}
        ¦         +-{gdbus}
        ¦         +-{gmain}
        ¦         +-{probing-thread}
                               ¦         +-{gmain}
                               ¦         +-{menu-cache-io}
                               ¦         +-{gmain}

Can't find gdb here (unless {gdbus} means gdb of course...

Note that I do all my RPi operations from WEindows 7 via TightVNC and
PuTTY, if that is a concern. Has worked fine for years.

>Sorry but at this stage I dont have any more than those (wild) guesses.
>There is something else in the output that makes no sense. the 437 does 
>not belong there.
>I dont know if gdb generated this, or if something else in the middle 
>caused it.
>Usually all gdb output is prefixed &, ^, * and a few chars like that.
>The GDB line starts with the ^ after the 437. That strongly suggests 
>something else printed that. (And it is not your app, the IDE has not 
>even send the filename at this stage, so your app can not be loaded yet)
The Lazarus interface is what is running gdb, I would think. But I did
not do antything with Lazarus during my Raspbian upgrade....

Bo Berglund
Developer in Sweden

More information about the Lazarus mailing list