Jacob, Thanks for your great explanation, and I'll definitely get GDB fixed so we no longer include the tool init file as a library.
When you said: > > There's many calls to 'search_and_load_file' in dejagnu (the core of > > things like load_lib and load_tool_init), but only some of them are > > guarded with a check of loaded_libs. Would there be an advantage of > > moving the loaded_libs check into 'search_and_load_file', and placing > > the absolute path to the file being loaded into loaded_libs? > > That might be a good idea, but I have been told > (<URL:http://lists.gnu.org/archive/html/dejagnu/2019-01/msg00032.html>) that > the "*load*" procedures should be considered stable API and that refactoring > them is ill-advised without great care due to their use in board description > files, only some of which are shipped with DejaGnu. I wondered if the solution might be to have search_and_load_file and take a callback, then the *load* procedures that currently don't check loaded_libs can continue to not check, while those that do, can defer the check until they know the exact path. I've attached two patches that work toward this goal, the first is a small cleanup you might consider (using 'file join' instead of hard-coding '/'), while the second patch implements the callback. In the spirit of trying to nudge users toward doing "the right thing", the callback will detect users that include the tool init file as a library and warn, but then continue to give the original behaviour of not including the file a second time. Thanks, Andrew --- Andrew Burgess (2): Use 'file join' to concatenate directory and filename Move loaded_libs check into search_and_load_file ChangeLog | 19 ++++++++++++++ runtest.exp | 85 +++++++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 76 insertions(+), 28 deletions(-) -- 2.14.5 _______________________________________________ DejaGnu mailing list DejaGnu@gnu.org https://lists.gnu.org/mailman/listinfo/dejagnu