[fpc-devel] fixing/extending dwarf support // Re: RECENT Commit breaking FpDebug - Dwarf / and not even fully fixing the original issue
Martin Frb
lazarus at mfriebe.de
Thu Apr 30 19:31:57 CEST 2026
On 30/04/2026 18:52, Graeme Geldenhuys via fpc-devel wrote:
> On Thursday, 30 April 2026 15:35:38 BST Martin Frb via fpc-devel wrote:
>> I was thinking about a tool (maybe to be included in automated testing)
>> that could run gdb and lldb on given test-code (including compiling that
>> code).
>> And then inject commands like "p MyObject^" and regex the output for
>> known field-names and -value (the formatting of those doesn't matter,
>> only the presence).
>>
>> If that is of interest I may further look into it.
> GDB already has that built-in. I've used it extensively in my projects for
> automated tests.
>
> There are two primary ways to do this: using the `-ex` flag for quick commands
> or the `-x` flag for script files.
>
> Example: Run a program, print a variable, and exit
>
> $> gdb -batch -ex "break main" -ex "run" -ex "print my_variable" -ex "bt" ./
> my_program
Not exactly what I meant... If you do it this way, then you can only
match the entire output against one expectation for it all.
As a human, that is fine, => if you want to run it manually and see..
Though, if you want to test hundreds of values, then you would not check
them all manually.
I actually had already started something.
It takes a list
p data | val\b.*\b42
gdb command, pipe, regex
=> and that regex must match the output of exactly that one command.
And then it can loop over lots of them.
The tool also takes the location of the compiler, and the location of
the pas source.
But, if you want to test against several versions of gdb, then you need
to run several times.
The question to the fpc team then is, would they want to add that to the
test suite?
That would mean there needs to be (at least) one gdb in a known
location. And then the freshly build fpc, would be asked to compile the
test-sources, and they would run through gdb (or lldb).
Of course you change the version of the gdb used, and then you may need
to do updates to the test.
More information about the fpc-devel
mailing list