6

I'm using CLion in order to connect to remote gdbserver which is run on remote machine (via ssh port forwarding).

I't works quite well except one thing, it downloads all linked dependencies every time I connect to gdbserver:

enter image description here

So, I could not find out is there any flag to pass in gdb remote to cache such files.

Ivan Talalaev
  • 6,014
  • 9
  • 40
  • 49

2 Answers2

2

There is no built-in way to do this.

You could do it by hand by copying all the needed files once, and then using set sysroot. But, that's a bit error-prone, as you must remember to sync whenever anything changes.

Another idea would be to set up some kind of caching remote filesystem. (But I don't know if a canned one that does this exists.)

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63
2

If your problem is not caching the libs but actually speeding up the GDB starting process you could set solib-absolute-prefix to a location on your host that contains all the shared libs. If you are using a nfs mounted environment for your target on your host. You could use the solib-absolute-prefix to set the path of shared libraries to your nfs host location so you don't retrieve them through the network every time you start the session.

Guillaume.P
  • 421
  • 1
  • 4
  • 12
  • yep I'm using sshfs as mounted directory. So you suggest to `set sysroot` (The set solib-absolute-prefix command is an alias for set sysroot.) to the mounted folder, in order to speed up via nfs/sshfs caching process, right? or why I don't retrieve the every time? – Ivan Talalaev Oct 06 '17 at 15:16
  • i'm just saying that loading the libraries from your host instead of your target should be faster and by using the nfs folder you get rid of potential synchronization problem as underlined by Tom Tromey because your host and target are using the same location to load the libs. – Guillaume.P Oct 06 '17 at 15:25
  • sshfs with `transform_symlinks` definitely does the trick. Thanks! – Ivan Talalaev Oct 06 '17 at 16:50