Sign in Join

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

Mailing lists / lazarus / 2014-03

debugging parts of rtl from within lazarus

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Mark Morgan Lloyd
to Marc Santhoff
Marc Santhoff wrote 10 lines
Hi, the FAQ gives instructions for debugging FCL from within lazarus. http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_can_I_debug_FCL_components_from_packages_with_Lazarus Does this work for RTL packages as well? I need to set breakpoints inside serial.pp to see what data SerRead and SerWrite really get.

I'm fairly sure that I used Lazarus to set breakpoints in that unit, but when I was working on it I'd have been using a copy in my project's working directory.

The patch at http://mantis.freepascal.org/view.php?id=18946 contains a test program that you might find useful, it's quirky but I used it heavily when testing the unit for Linux/Solaris/Windows.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Martin Frb
to Marc Santhoff: the FAQ gives instructions for debugging FCL from within lazarus.…
Marc Santhoff wrote 5 lines
the FAQ gives instructions for debugging FCL from within lazarus. http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_can_I_debug_FCL_components_from_packages_with_Lazarus Does this work for RTL packages as well?

The IDE doesn't rebuild RTL , or fpc packages. But if you have your own fpc build, you can always rebuild and install it with debug info.

Once the debug info is there it will work.

Reply by email

Marc Santhoff
to Mark Morgan Lloyd: I'm fairly sure that I used Lazarus to set breakpoints in that unit, but when I was…
Mark Morgan Lloyd wrote 19 lines
Marc Santhoff wrote: > Hi, > > the FAQ gives instructions for debugging FCL from within lazarus. > > http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_can_I_debug_FCL_components_from_packages_with_Lazarus > > Does this work for RTL packages as well? > > I need to set breakpoints inside serial.pp to see what data SerRead and > SerWrite really get. I'm fairly sure that I used Lazarus to set breakpoints in that unit, but when I was working on it I'd have been using a copy in my project's working directory. The patch at http://mantis.freepascal.org/view.php?id=18946 contains a test program that you might find useful, it's quirky but I used it heavily when testing the unit for Linux/Solaris/Windows.

Many thanks, it will be useful. :)

But some questions popping up:
In the patch report you write SerFlush() is non-destructive and the new SerFlushInput/Output() are destructive.

What does this mean exactly?

From my memory using "flush" on a file descriptor is used to force

writing the pending contents through to the disk or file or whatever is connected.
Regarding serial ports there mostly is a hardware function for emptying the read oder write queue while throwing away anything in there. Is that the difference in the flushing you're talking about?

Marc Santhoff

Reply by email

Marc Santhoff
to Martin Frb: The IDE doesn't rebuild RTL , or fpc packages. But if you have your own fpc build, you…
Martin Frb wrote 9 lines
On 17/03/2014 16:40, Marc Santhoff wrote: > the FAQ gives instructions for debugging FCL from within lazarus. > > http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_can_I_debug_FCL_components_from_packages_with_Lazarus > > Does this work for RTL packages as well? The IDE doesn't rebuild RTL , or fpc packages. But if you have your own fpc build, you can always rebuild and install it with debug info.

I have no own build but the sources. Reading the FAQ it should work to cd to .../rtl/unix, build with -gl, and afterwards install the new ppu to the same location as the compiler.

I'd like better if I could switch a standard version and a debugging version of the RTL. If it works in general this could be done by some conditionals in .fpc.cfg, I think.

Where I'm not sure is if the build RTL build and install works the same as for lazarus packages.

Once the debug info is there it will work.

I'll try.

Marc Santhoff

Reply by email

Sven Barth
to Marc Santhoff
"Marc Santhoff" wrote 6 lines
> The IDE doesn't rebuild RTL , or fpc packages. But if you have your own > fpc build, you can always rebuild and install it with debug info. I have no own build but the sources. Reading the FAQ it should work to cd to .../rtl/unix, build with -gl, and afterwards install the new ppu to the same location as the compiler.

You should merely go to $fpcsrc/rtl and do "make clean all OPT=-gl". Your source should be of the same compiler version as the compiler you build with. Also if you use a unit (or a package) that depends on any of the recompiled units that will need to be recompiled as well. So for RTL I would suggest you to only copy the Serial unit as dependencies on that should be rather low. Additionally you won't be annoyed by having the debugger step all helper routines used by the compiler.

Note: the location "same as compiler" would be wrong. You need to copy the unit to the location where the "normal" serial.ppu and serial.o are stored (and you should make a backup of course). Normally thus should he something like /usr/lib/fpc/2.6.4/units/i386-linux/rtl or so...

I'd like better if I could switch a standard version and a debugging version of the RTL. If it works in general this could be done by some conditionals in .fpc.cfg, I think.

In that case you should recompile the complete source (inside the $fpcsrc directory) with OPT=-gl and then you'll need to install the units to a different location (e.g. /usr/lib/2.6.4/units-dbg) and then adjust the fpc.cfg to use a different set of paths if you specify a special define on the command line (e.g. -dDEBUG_UNITS)

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140317/c385988e/attachment.html>

Reply by email

Mark Morgan Lloyd
to Marc Santhoff: Many thanks, it will be useful. :) But some questions popping up: In the patch report you…
Marc Santhoff wrote 27 lines
On Mo, 2014-03-17 at 17:22 +0000, Mark Morgan Lloyd wrote: > Marc Santhoff wrote: >> Hi, >> >> the FAQ gives instructions for debugging FCL from within lazarus. >> >> http://wiki.lazarus.freepascal.org/Lazarus_Faq#How_can_I_debug_FCL_components_from_packages_with_Lazarus >> >> Does this work for RTL packages as well? >> >> I need to set breakpoints inside serial.pp to see what data SerRead and >> SerWrite really get. > I'm fairly sure that I used Lazarus to set breakpoints in that unit, but > when I was working on it I'd have been using a copy in my project's > working directory. > > The patch at http://mantis.freepascal.org/view.php?id=18946 contains a > test program that you might find useful, it's quirky but I used it > heavily when testing the unit for Linux/Solaris/Windows. Many thanks, it will be useful. :) But some questions popping up: In the patch report you write SerFlush() is non-destructive and the new SerFlushInput/Output() are destructive. What does this mean exactly?

I'm working from memory here. SerFlush() tried to do a sync(), which was considered to be pointless so is now marked deprecated. If you really do want to do this, then use SerSync().

SerDrain() waits until pending output has been sent i.e. is non-destructive, SerFlushInput() and SerFlushOutput() both clear buffers so are destructive.

Please note that these are basically very thin wrappers around the unix (Linux/Solaris) API.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marc Santhoff
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 16 lines
Marc Santhoff wrote: > On Mo, 2014-03-17 at 17:22 +0000, Mark Morgan Lloyd wrote: > But some questions popping up: > In the patch report you write SerFlush() is non-destructive and the new > SerFlushInput/Output() are destructive. > > What does this mean exactly? I'm working from memory here. SerFlush() tried to do a sync(), which was considered to be pointless so is now marked deprecated. If you really do want to do this, then use SerSync(). SerDrain() waits until pending output has been sent i.e. is non-destructive, SerFlushInput() and SerFlushOutput() both clear buffers so are destructive.

OK, that matches my memory.

Please note that these are basically very thin wrappers around the unix (Linux/Solaris) API.

Understood, so the system man pages and maybe Stevens are my friends.

Many thanks!

Marc Santhoff

Reply by email

Marc Santhoff
to Sven Barth: You should merely go to $fpcsrc/rtl and do "make clean all OPT=-gl". Your source should…
Sven Barth wrote 15 lines
Am 17.03.2014 20:23 schrieb "Marc Santhoff" : > > The IDE doesn't rebuild RTL , or fpc packages. But if you have your own > > fpc build, you can always rebuild and install it with debug info. > > I have no own build but the sources. Reading the FAQ it should work to > cd to .../rtl/unix, build with -gl, and afterwards install the new ppu > to the same location as the compiler. You should merely go to $fpcsrc/rtl and do "make clean all OPT=-gl". Your source should be of the same compiler version as the compiler you build with. Also if you use a unit (or a package) that depends on any of the recompiled units that will need to be recompiled as well. So for RTL I would suggest you to only copy the Serial unit as dependencies on that should be rather low. Additionally you won't be annoyed by having the debugger step all helper routines used by the compiler.

Makes lots of sense, I think I'll go the way of copying only serial.pp.

Note: the location "same as compiler" would be wrong. You need to copy the unit to the location where the "normal" serial.ppu and serial.o are stored (and you should make a backup of course). Normally thus should he something like /usr/lib/fpc/2.6.4/units/i386-linux/rtl or so...

OK, especially because the compiler installation(s) are in my home dir.

Show quoted text 10 lines
> > I'd like better if I could switch a standard version and a debugging > version of the RTL. If it works in general this could be done by some > conditionals in .fpc.cfg, I think. In that case you should recompile the complete source (inside the $fpcsrc directory) with OPT=-gl and then you'll need to install the units to a different location (e.g. /usr/lib/2.6.4/units-dbg) and then adjust the fpc.cfg to use a different set of paths if you specify a special define on the command line (e.g. -dDEBUG_UNITS)

OK, at least this mail is getting archived for being at hand when needed. This serial port thingy is the first time ever I really need to twiddle the RTL.

Danke Sven!

Marc Santhoff

Reply by email