I have a huge monolith with more than 100 shared libraries. Some of them are so huge that if I let GDB load all the symbols, nearly all my PC RAM is filled up and I can do nothing else. So I want to disable loading all the libraries, and only load the libraries that I need. I accomplish this in two steps:
Disable loading all symbols
set auto-solib-add off
After the application has booted, load only the required libraries
shared /opt/build/Bin/drivers/*
Now my intention is to automate this using .gdbinit file(which is also loaded by my IDE, QtCreator). However, given the commands are executed during GDB startup, I am not sure how to execute the second command without knowing if the corresponding libraries are loaded. Any help is very appreciated. Thank you.