Sign in Join

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

Mailing lists / fpc-pascal / 2021-02

self corrupted after jump to overridden method

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner

Hi,

I have a strange bug, that suddenly Self becomes a random value when calling an overridden virtual method. It happens when activating a TCustomSQLQuery.
Below is a gdb stacktrace with fpc 3.3.1, where Self became 0. On other runs I saw various other values.

Where to start looking?
It happens in Lazarus at designtime, so maybe some vmt issue?

#0 0x00000000013cba40 in INTERNALOPEN (this=0x0) at fcl-db/src/sqldb/sqldb.pp:3140

#1 0x0000000001250f1d in DOINTERNALOPEN
(this=0x7fffffffc5c0) at fcl-db/src/base/dataset.inc:410

#2
0x00000000012520f1 in OPENCURSOR (this=0x7ffff52aab50, INFOQUERY=184) at fcl-db/src/base/dataset.inc:958

#3 0x00000000013cac53 in OPENCURSOR
(this=0x7ffff52aab50, INFOQUERY=false) at
fcl-db/src/sqldb/sqldb.pp:2824

#4 0x0000000001252518 in SETACTIVE
(this=0x7ffff52aab50, VALUE=true) at fcl-db/src/base/dataset.inc:1093

#5 0x000000000057a662 in SETORDPROP (INSTANCE=0x7fffffffd001, PROPINFO=0x7ffff52aab50, VALUE=1) at ../objpas/typinfo.pp:1898

#6
0x0000000000a7a239 in SETORDVALUE (this=0x7fffc47155e0, NEWVALUE=1) at propedits.pp:3315

Mattias

Reply by email

Mattias Gaertner
to Mattias Gaertner
Show quoted text 7 lines
Hi, I have a strange bug, that suddenly Self becomes a random value when calling an overridden virtual method. It happens when activating a TCustomSQLQuery. Below is a gdb stacktrace with fpc 3.3.1, where Self became 0. On other runs I saw various other values.

My patch turns the crash into a normal Exception:
https://bugs.freepascal.org/view.php?id=38503

Where to start looking? It happens in Lazarus at designtime, so maybe some vmt issue?

Turns out it was an evil combination of optimization and misleading gdb output.

Mattias

Reply by email