Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module

Jan Kratochvil
2012-09-22T13:30:59Z

On Tue, 18 Sep 2012 22:39:51 +0200, Khoo Yit Phang wrote:
> I'd still like to add this warning: even with the data-directory patch
> I just posted, it is still possible for this issue to occur, e.g., due to
> a bad install. Some minor fixes:
>
> GDB is unable to find its auxiliary files. You may need to provide the
> -data-directory flag to GDB (please refer to the manual for details).

There has been already discussion about how to reference the GDB manual and
the checked in variant is:
------------------------------------------------------------------------------
commit 86635be5fbe89ff6c300de47fac5a70bf01486c1
To enable execution of this file add
add-auto-load-safe-path /home/jkratoch/redhat/gdb-clean/gdb/gdb-gdb.gdb
line to your configuration file "/home/jkratoch/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/jkratoch/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
------------------------------------------------------------------------------

I find the proposed message "GDB is unable to find its auxiliary files."
redundant to the already printed:
warning: Could not load the Python gdb module from `dfasdfsa/python'.

I would also change the second warning -> printf_filtered as it will then no
longer insert so many empty lines there.

In the end the output could be:
------------------------------------------------------------------------------
Python Exception <type 'exceptions.ImportError'> No module named gdb:

warning: Could not load the Python gdb module from `dfasdfsa/python'.
You may need to provide the -data-directory flag to GDB.
Limited Python support is available from the _gdb module.
For more information about GDB dependencies on external files
see the "Data Files" section in the GDB manual. E.g., run from the shell:
info "(gdb)Data Files"
------------------------------------------------------------------------------

Do you agree or would you like to make more adjustments to the text?

Thanks,
Jan