[Qbs] Running the target through a wrapper

Christian Kandeler christian.kandeler at qt.io
Mon Oct 10 09:52:25 CEST 2022


On 10/8/22 18:17, Alberto Mardegan wrote:
> Hi all!
>   On some occasions I've found myself in need of debugging the 
> executable under gdb, strace and valgrind. Running
>
>     gdb ./default/install-root/usr/local/bin/MyApp
>
> has always worked well for me, but I wonder:
>
> 1) Would this break if the app depends on shared libraries existing in 
> the same project, unless the user explicitly sets LD_LIBRARY_PATH to 
> the proper locations?

Yes.

>
> 2) Can we make it even simpler?
>
> I'm considering the idea of adding an option to run the target under a 
> wrapper, something like
>
>     qbs run --products MyApp --wrapper "valgrind --trace-children=yes"
>
> Does anyone have plans to implement something similar? If not, and if 
> you think that the idea is sound, I might give it a go (hints welcome).

RunEnvironment::doRunTarget() has some hardcoded wrapper logic for 
Android and iOS; you could try generalizing it.

Some Desktop/remote differentiation will likely be necessary, i.e. set 
LD_LIBRARY_PATH & friends only for the former. (We could be more 
ambitious and set things up on the remote side too, e.g. when the 
wrapper is ssh. But that's probably out of scope for the first iteration).


Christian



More information about the Qbs mailing list