[vlc-devel] [PATCH] libvlc: dump object types abd names when leaking

Hannes Domani ssbssa at yahoo.de
Mon Feb 25 20:56:38 CET 2019


Am Freitag, 22. Februar 2019, 07:43:50 MEZ hat Steve Lhomme <robux4 at ycbcr.xyz> Folgendes geschrieben:

> Not only gdb+qt is a bad combination (you either choose to get 20 breaks
> at each run or break on legit asserts) but it's not the worst part.
> 
> VLC has hundreds of DLLs and loads tens of them just to play a file
> (that's when you have plugins cache working). For every DLL loaded gdb
> tries to load the symbol. In worst cases (if you happen to set more than
> 2 breakpoints) it can take 1s per DLL on my super fast machine (and all
> other machines I've used in the past years). Making debugging any line
> change a nightmare. Let alone the code that times out because the
> debugger didn't finish loading some other parts.
> 
> MSVC has none of these issues, it's very fast to load and you can put
> keep 100 breakpoints and works just as fast.


I did a quick profiling of gdb when starting vlc, and found a very obvious
bottleneck.
Each time a dll is loaded/unloaded, internally a new list of all current dlls
is requested, and for each one, the .text section offset is read of the file.
And if the list is long, the list is transmitted in multiple parts, and all of
that is done for each part submitted.
So if you have a lot of loaded dlls, a lot of file-reading is happening.

I've made a simple change to read this offset only when the dll is added to the
internal list (and remember it).

=== ORIGINAL GDB ===
with plugins-cache:
  - startup: 5s
  - shutdown: ~1s
without plugins-cache:
  - startup: 1m 50s
  - shutdown: 1m 45s

=== NEW GDB ===
with plugins-cache:
  - startup: 4s
  - shutdown: 1s
without plugins-cache:
  - startup: 10s
  - shutdown: 3s

You can try it out here: https://github.com/ssbssa/gdb/releases


I also tried to see why breakpoints slow gdb down so much.
It's a similar problem, each time a dll is loaded/unloaded, all breakpoints
are reset, which means for each breakpoint all loaded dlls are checked for
any symbol the breakpoint could match.

That's obviously also very slow, but from what I can tell, this same problem
should exist on Linux as well.
So sadly I don't have a solution for this.


RegardsHannes Domani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190225/f5a257c0/attachment.html>


More information about the vlc-devel mailing list