On samedi 4 juin 2022 19:24:46 CEST mark_at_yahoo via Rosegarden-devel wrote:
> I created ("painted") four notes, each time getting:
> 
> BasicCommand::execute
> MatrixScene::handleEventRemoved
> QGraphicsScene::update
> QGraphicsScene::update
> 
> I have no idea where the second update is coming from.

That's an artefact of your debugging technique, due to a not very well known
feature of shared libraries called (PLT Procedure Linkage Table).

After doing
     dprintf QGraphicsScene::update, "QGraphicsScene::update\n"
if you ask gdb for its breakpoints, you'll see that this matched two locations:

(gdb) info br
Num     Type           Disp Enb Address            What
2       dprintf        keep y   <MULTIPLE>
        breakpoint already hit 411 times
        printf "QGraphicsScene::update\n"
2.1                         y   0x00007ffff6b71a66 in 
QGraphicsScene::update(QRectF const&) at 
qtbase/src/widgets/graphicsview/qgraphicsscene.cpp:3213
2.2                         y   0x00007ffff722a950 
<QGraphicsScene::update(QRectF const&)@plt>

The second one (@plt) is a thin wrapper over the first one, to implement 
Position Independent Code.
The question in 
https://stackoverflow.com/questions/70589450/why-functions-in-same-shared-library-using-plt
explains this better than I would:
"For each function we call (func) in our library, there's a func@plt small 
procedure, which is the one actually being called. This procedure then jumps to 
an address stored in a corresponding entry in the GOT. First, this address will 
point back to the PLT entry which will then call the dynamic linker resolver to 
resolve the actual function's address. The dynamic linker will now override the 
entry in the GOT to point to the correct actual function."

Executive summary: QGraphicsScene::update() is called only once in practice, in 
your scenario.

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5





_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to