Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-07

Lazarus cannot debug after Raspbian upgrade

13 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

Moving this thread to Lazarus, posted to FPC by mistake. -------------------------------------------------------- I just upgraded my Raspberry Pi3 from the March to the May version of Raspbian using the dist-upgrade command and then rebooted.

Now Lazarus has problems with running some debugging sessions, it immediately displays an error box saying that the debugger failed. More info shows:

The GDB command:
"-gdb-set confirm off"
did not return any result.

I have never seen this before so I am at a loss here, can someone please help out?
A project that worked fine yesterday before the Raspbian upgrade exhibits this now.

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund
Bo Berglund wrote 13 lines
Moving this thread to Lazarus, posted to FPC by mistake. -------------------------------------------------------- I just upgraded my Raspberry Pi3 from the March to the May version of Raspbian using the dist-upgrade command and then rebooted. Now Lazarus has problems with running some debugging sessions, it immediately displays an error box saying that the debugger failed. More info shows: The GDB command: "-gdb-set confirm off" did not return any result.

Sounds like a bug in gdb.

what is in the "debug output" window? (open the window BEFORE pressing F9)

What version of gdb?

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

Reply by email

Bo Berglund
to Martin Frb
Martin Frb wrote 18 lines
On 29/07/2016 14:31, Bo Berglund wrote: > Moving this thread to Lazarus, posted to FPC by mistake. > -------------------------------------------------------- > I just upgraded my Raspberry Pi3 from the March to the May version of > Raspbian using the dist-upgrade command and then rebooted. > > Now Lazarus has problems with running some debugging sessions, it > immediately displays an error box saying that the debugger failed. > More info shows: > > The GDB command: > "-gdb-set confirm off" > did not return any result. > 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>

What version of gdb?
$ gdb --ver
GNU gdb (Raspbian 7.7.1+dfsg-5) 7.7.1
Show quoted text 8 lines
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.

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund
Bo Berglund wrote 20 lines
On Fri, 29 Jul 2016 14:45:22 +0100, Martin Frb 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. Enter

-gdb-set confirm off
(and then return)

copy the output.

Enter
q
to exit gdb

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....

Show quoted text 14 lines
> 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?

From the code in components\lazdebuggergdbmi\cmdlinedebugger.pp

Show quoted text 10 lines
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?

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)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160730/abc51768/attachment.html>

Reply by email

Bo Berglund
to Martin Frb
Martin Frb wrote 36 lines
On 29/07/2016 21:59, Bo Berglund wrote: > On Fri, 29 Jul 2016 14:45:22 +0100, Martin Frb > 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. Enter -gdb-set confirm off (and then return) copy the output. Enter q to exit gdb

pi at rpi3-jessie:~ $ gdb -i mi
=thread-group-added,id="i1"
~"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" ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n" ~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n" (gdb)
-gdb-set confirm off
^done
(gdb)

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....

Show quoted text 21 lines
>> 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.

Show quoted text 24 lines
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 pstree:

pi at rpi3-jessie:~ $ pstree
systemd---Xtightvnc
+-apache2---5*[apache2]
+-autocutsel
+-avahi-daemon---avahi-daemon
+-bluetoothd
+-cron
+-3*[dbus-daemon]
+-2*[dbus-launch]
+-dhcpcd
+-gpsd
+-2*[gvfs-afc-volume---{gdbus}]
¦ +-{gvfs-afc-volume}]
+-2*[gvfs-goa-volume---{gdbus}]
+-2*[gvfs-gphoto2-vo---{gdbus}]
+-2*[gvfs-mtp-volume---{gdbus}]
+-2*[gvfs-udisks2-vo---{gdbus}]
¦ +-{gmain}]
+-2*[gvfsd---{gdbus}]
+-2*[gvfsd-fuse---{gdbus}]
¦ +-{gvfs-fuse-sub}]
¦ +-2*[{gvfsd-fuse}]]
+-gvfsd-trash---{gdbus}
¦ +-{gmain}
+-gvfsd-trash---{gdbus}
¦ +-{gmain}
¦ +-{pool}
+-hciattach
+-lightdm---Xorg---{llvmpipe-0}
¦ ¦ +-{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}
+-login---bash
+-2*[menu-cached---{gdbus}]
¦ +-{gmain}]
+-nmbd
+-ntpd
+-polkitd---{gdbus}
¦ +-{gmain}
+-rsyslogd---{in:imklog}
¦ +-{in:imuxsock}
¦ +-{rs:main Q:Reg}
+-rtkit-daemon---2*[{rtkit-daemon}]
+-smbd---smbd
+-2*[ssh-agent]
+-sshd---sshd---sshd---bash---pstree
+-2*[start-pulseaudi---xprop]
+-startlazarus---lazarus---{gdbus}
+-systemd-journal
+-systemd-logind
+-systemd-udevd
+-thd
+-udisksd---{cleanup}
¦ +-{gdbus}
¦ +-{gmain}
¦ +-{probing-thread}
+-wpa_supplicant
+-xstartup---lxsession---lxpanel---{gdbus}
¦ +-{gmain}
¦ +-{menu-cache-io}
+-lxpolkit---{gdbus}
+-openbox
+-pcmanfm---{gdbus}
¦ +-{gmain}
+-ssh-agent
+-{gdbus}
+-{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.

Show quoted text 15 lines
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

Reply by email

Bo Berglund
to Martin Frb: Can you open a shell or terminal, and in it enter gdb -i mi (and then return) gdb will…
Martin Frb wrote
Sorry but at this stage I dont have any more than those (wild) guesses.

Well, that is even more than I have at the moment... Thanks for your interest and contribution!

Note that not all Lazarus projects are affected by this.

The project I am looking at, which prompted me to update Raspbian, was supplied by a person at the fpc list in regard to controlling the hardware on an RPi from Pascal. Apparently there is an improvement in the access possibilities for the GPIO functionality in the latest Raspbian where one can even connect via the network and switch on/off outputs and read inputs.
The provider had ported some C code library to FreePascal and claims that it is now very simple to access the GPIO even via the network.

Since I am programming the Pi using rather much of the GPIO to control relays and stuff I was interested in testing it out, but first it would not build because of the lack of the support functions in my Raspbian version and after the update it builds but would not start due to the gdb problems.
I still can use my old code going directly to memgpio to switch the relays, though, so it is no showstopper.

I probably will not spend much more time on this now since I am soon away for a week-long trip.

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund
Bo Berglund wrote 9 lines
On Sat, 30 Jul 2016 03:54:32 +0100, Martin Frb wrote: > Sorry but at this stage I dont have any more than those (wild) guesses. Well, that is even more than I have at the moment... Thanks for your interest and contribution! Note that not all Lazarus projects are affected by this.

This is odd.

"-gdb-set confirm off" is the very first command that the ide sends to gdb. gdb can therefore not know which app you are trying to debug. The filename is sent later. only.
So I dont know, how it can depend on the file you want to debug?

It strange, but I have no idea, sorry.

You dont have anything in Debugger_Startup_Options?

Reply by email

Bo Berglund
to Martin Frb
Martin Frb wrote 13 lines
On 30/07/2016 09:17, Bo Berglund wrote: > Note that not all Lazarus projects are affected by this. > This is odd. "-gdb-set confirm off" is the very first command that the ide sends to gdb. gdb can therefore not know which app you are trying to debug. The filename is sent later. only. So I dont know, how it can depend on the file you want to debug? It strange, but I have no idea, sorry. You dont have anything in Debugger_Startup_Options?

Where can I find this? I looked in Project options but did not find anything seemingly connected to that.

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund
Bo Berglund wrote 7 lines
On Sat, 30 Jul 2016 12:45:54 +0100, Martin Frb wrote: > > You dont have anything in Debugger_Startup_Options? Where can I find this? I looked in Project options but did not find anything seemingly connected to that.

It is in the global options. in the property grid of the debugger settings.

But it would apply to all projects. And if your error is some project only.....

Another thing, that may be worth checking is if you did set any Environment values (run > run params)
that would be per project.

Reply by email

Bo Berglund
to Martin Frb
Martin Frb wrote 17 lines
On 30/07/2016 16:37, Bo Berglund wrote: > On Sat, 30 Jul 2016 12:45:54 +0100, Martin Frb > wrote: > >> >> You dont have anything in Debugger_Startup_Options? > Where can I find this? I looked in Project options but did not find > anything seemingly connected to that. It is in the global options. in the property grid of the debugger settings. But it would apply to all projects. And if your error is some project only..... Another thing, that may be worth checking is if you did set any Environment values (run > run params) that would be per project.

All I see there is an override for the IP address of PIGPIO: PIGPIO_ADDR = 192.168.185.97
which is totally wrong for my network in any case
That identifier is used in a statement like this to set a const value: PI_ENVADDR = 'PIGPIO_ADDR';

But however I search I cannot see where this is later used in the project...

Anyway, changing it to the valid address of my Pi did not stop the gdb error. :(

Bo Berglund Developer in Sweden

Reply by email

Koenraad Lelong
to Bo Berglund

Op 30-07-16 om 18:12 schreef Bo Berglund:

Show quoted text 33 lines
On Sat, 30 Jul 2016 16:43:03 +0100, Martin Frb wrote: > On 30/07/2016 16:37, Bo Berglund wrote: >> On Sat, 30 Jul 2016 12:45:54 +0100, Martin Frb >> wrote: >> >>> >>> You dont have anything in Debugger_Startup_Options? >> Where can I find this? I looked in Project options but did not find >> anything seemingly connected to that. > > It is in the global options. in the property grid of the debugger settings. > > But it would apply to all projects. And if your error is some project > only..... > > Another thing, that may be worth checking is if you did set any > Environment values (run > run params) > that would be per project. All I see there is an override for the IP address of PIGPIO: PIGPIO_ADDR = 192.168.185.97 which is totally wrong for my network in any case That identifier is used in a statement like this to set a const value: PI_ENVADDR = 'PIGPIO_ADDR'; But however I search I cannot see where this is later used in the project... Anyway, changing it to the valid address of my Pi did not stop the gdb error. :(

Bo,

That environment variable is a remainder of previous tests. The original c-test-program (x_pigpiod_if2) can be used in two ways : without that environment variable, then the defaults are used (ip-address 127.0.0.1 and port 8888), or with environment variables set, then those values are used for port and/or ip-address. The lazarus program never did use these environment variables.

Would it be a problem if you used the latest ready-made image of raspbian, and try again ? I used that image and only did safe-upgrade's after that. I never used the distupgrade.

Koenraad.

Reply by email

Bo Berglund
to Koenraad Lelong
Koenraad Lelong wrote 14 lines
Bo, That environment variable is a remainder of previous tests. The original c-test-program (x_pigpiod_if2) can be used in two ways : without that environment variable, then the defaults are used (ip-address 127.0.0.1 and port 8888), or with environment variables set, then those values are used for port and/or ip-address. The lazarus program never did use these environment variables. Would it be a problem if you used the latest ready-made image of raspbian, and try again ? I used that image and only did safe-upgrade's after that. I never used the distupgrade. Koenraad.

Well,
the Pi I am testing on has a lot of other stuff installed like FPC/Lazarus and component packages in Lazarus etc etc. It is used as a development platform for a data logging automation software system (where I use the GPIO to control power relays). Because of the relay/GPIO issue I was interested when I read about the new GPIO server in Jessie and the Pascal port of the C code you have done.

But I cannot re-image the Pi right now with the May Jessie image because I will have to go through all of the setup issues I have already dealt with on the system I have.

Bo Berglund Developer in Sweden

Reply by email

Koenraad Lelong
to Bo Berglund

Op 30-07-16 om 23:00 schreef Bo Berglund:

Show quoted text 14 lines
Well, the Pi I am testing on has a lot of other stuff installed like FPC/Lazarus and component packages in Lazarus etc etc. It is used as a development platform for a data logging automation software system (where I use the GPIO to control power relays). Because of the relay/GPIO issue I was interested when I read about the new GPIO server in Jessie and the Pascal port of the C code you have done. But I cannot re-image the Pi right now with the May Jessie image because I will have to go through all of the setup issues I have already dealt with on the system I have.

If you only have one sd-card, you could clone your existing sd-card and re-image it. Afterwards, you can restore that image. As far as I remember, I just copied all lazarus/fpc stuff from my old image to the new. That's one of the reasons why installing in a user-directory is so interesting.

Koenraad.

Reply by email