* [PATCH] Warn about data-directory when failing to import Python "gdb" module
@ 2012-09-17 19:36 Khoo Yit Phang
2012-09-17 20:23 ` Jan Kratochvil
0 siblings, 1 reply; 16+ messages in thread
From: Khoo Yit Phang @ 2012-09-17 19:36 UTC (permalink / raw)
To: GDB Patches; +Cc: Khoo Yit Phang
[-- Attachment #1: Type: text/plain, Size: 295 bytes --]
Hi,
I'd like to add a warning when failing to import the Python "gdb" module to check that data-directory is set correctly, to address the confusion arising from the incompatibility between the old "gdb" module and the one I recently checked in.
Thank you,
Yit
September 17, 2012
[-- Attachment #2: warn-gdb-python-compat.txt --]
[-- Type: text/plain, Size: 681 bytes --]
gdb/ChangeLog
2012-09-17 Khoo Yit Phang <khooyp@cs.umd.edu>
* gdb/python.c (finish_python_initialization): Augment the warning
when importing "gdb" fails, to check that data-directory is set
correctly.
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1484,6 +1484,7 @@
gdbpy_print_stack ();
warning (_("Could not load the Python gdb module from `%s'."),
gdb_pythondir);
+ warning (_("Please make sure that data-directory is set correctly."));
warning (_("Limited Python support is available from the _gdb module."));
do_cleanups (cleanup);
return;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 19:36 [PATCH] Warn about data-directory when failing to import Python "gdb" module Khoo Yit Phang
@ 2012-09-17 20:23 ` Jan Kratochvil
2012-09-17 20:28 ` Khoo Yit Phang
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2012-09-17 20:23 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: GDB Patches
On Mon, 17 Sep 2012 21:36:37 +0200, Khoo Yit Phang wrote:
> + warning (_("Please make sure that data-directory is set correctly."));
Couldn't you make it more explicit, such as mentioning the -data-directory
command-line parameter and that it should contain file python/gdb/__init__.py
or that it is gdb/data-directory in the source tree or some such wording?
Thanks,
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 20:23 ` Jan Kratochvil
@ 2012-09-17 20:28 ` Khoo Yit Phang
2012-09-17 20:36 ` Jan Kratochvil
2012-09-17 20:58 ` Joel Brobecker
0 siblings, 2 replies; 16+ messages in thread
From: Khoo Yit Phang @ 2012-09-17 20:28 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Khoo Yit Phang, GDB Patches
Hi,
On Sep 17, 2012, at 4:22 PM, Jan Kratochvil wrote:
> On Mon, 17 Sep 2012 21:36:37 +0200, Khoo Yit Phang wrote:
>> + warning (_("Please make sure that data-directory is set correctly."));
>
> Couldn't you make it more explicit, such as mentioning the -data-directory
> command-line parameter and that it should contain file python/gdb/__init__.py
> or that it is gdb/data-directory in the source tree or some such wording?
How about:
If you are running GDB from the build directory, please run gdb with the -data-directory flag set as appropriate, e.g., "builddir/gdb -data-directory builddir/data-directory".
Yit
September 17, 2012
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 20:28 ` Khoo Yit Phang
@ 2012-09-17 20:36 ` Jan Kratochvil
2012-09-17 20:58 ` Joel Brobecker
1 sibling, 0 replies; 16+ messages in thread
From: Jan Kratochvil @ 2012-09-17 20:36 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: GDB Patches
On Mon, 17 Sep 2012 22:27:45 +0200, Khoo Yit Phang wrote:
> How about:
>
> If you are running GDB from the build directory, please run gdb with the -data-directory flag set as appropriate, e.g., "builddir/gdb -data-directory builddir/data-directory".
I would use:
..., e.g., "builddir/gdb/gdb -data-directory builddir/gdb/data-directory".
Otherwise fine with me; but please keep the mail for possible other comments.
Thanks,
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 20:28 ` Khoo Yit Phang
2012-09-17 20:36 ` Jan Kratochvil
@ 2012-09-17 20:58 ` Joel Brobecker
2012-09-17 21:04 ` Khoo Yit Phang
2012-09-18 6:17 ` Eli Zaretskii
1 sibling, 2 replies; 16+ messages in thread
From: Joel Brobecker @ 2012-09-17 20:58 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: Jan Kratochvil, GDB Patches
> If you are running GDB from the build directory, please run gdb with
> the -data-directory flag set as appropriate, e.g., "builddir/gdb
> -data-directory builddir/data-directory".
I expect that the majority of users will *not* be running GDB out
of the build directory. If they encounter the same issue with a
poorly installed GDB (Eg: They copied the GDB binary from one location
to another without copying the remaining support files), the error
message is not going to help them.
I think that people who do run GDB from the build directory (a power
user setup) should be sufficiently knowledgeable, and we should try
to tailor the hints towards regular users.
--
Joel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 20:58 ` Joel Brobecker
@ 2012-09-17 21:04 ` Khoo Yit Phang
2012-09-18 20:40 ` Khoo Yit Phang
2012-09-18 6:17 ` Eli Zaretskii
1 sibling, 1 reply; 16+ messages in thread
From: Khoo Yit Phang @ 2012-09-17 21:04 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Khoo Yit Phang, Jan Kratochvil, GDB Patches
Hi,
On Sep 17, 2012, at 4:58 PM, Joel Brobecker wrote:
>> If you are running GDB from the build directory, please run gdb with
>> the -data-directory flag set as appropriate, e.g., "builddir/gdb
>> -data-directory builddir/data-directory".
>
> I expect that the majority of users will *not* be running GDB out
> of the build directory. If they encounter the same issue with a
> poorly installed GDB (Eg: They copied the GDB binary from one location
> to another without copying the remaining support files), the error
> message is not going to help them.
>
> I think that people who do run GDB from the build directory (a power
> user setup) should be sufficiently knowledgeable, and we should try
> to tailor the hints towards regular users.
Perhaps:
GDB is unable to find its support files. You may need to provide the -data-directory flag to GDB (refer to the man pages for more details).
Yit
September 17, 2012
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 20:58 ` Joel Brobecker
2012-09-17 21:04 ` Khoo Yit Phang
@ 2012-09-18 6:17 ` Eli Zaretskii
2012-09-18 11:58 ` Jan Kratochvil
1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-18 6:17 UTC (permalink / raw)
To: Joel Brobecker; +Cc: khooyp, jan.kratochvil, gdb-patches
> Date: Mon, 17 Sep 2012 13:58:29 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, GDB Patches <gdb-patches@sourceware.org>
>
> > If you are running GDB from the build directory, please run gdb with
> > the -data-directory flag set as appropriate, e.g., "builddir/gdb
> > -data-directory builddir/data-directory".
>
> I expect that the majority of users will *not* be running GDB out
> of the build directory. If they encounter the same issue with a
> poorly installed GDB (Eg: They copied the GDB binary from one location
> to another without copying the remaining support files), the error
> message is not going to help them.
>
> I think that people who do run GDB from the build directory (a power
> user setup) should be sufficiently knowledgeable, and we should try
> to tailor the hints towards regular users.
Is it possible to make GDB find its data-directory when it is run from
the directory where it was built?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-18 6:17 ` Eli Zaretskii
@ 2012-09-18 11:58 ` Jan Kratochvil
2012-09-18 12:21 ` Eli Zaretskii
2012-09-18 15:38 ` Khoo Yit Phang
0 siblings, 2 replies; 16+ messages in thread
From: Jan Kratochvil @ 2012-09-18 11:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Joel Brobecker, khooyp, gdb-patches
On Tue, 18 Sep 2012 08:17:29 +0200, Eli Zaretskii wrote:
> Is it possible to make GDB find its data-directory when it is run from
> the directory where it was built?
relocate_gdb_directory call could be adjusted to handle data-directory also in
the GDB build directory.
Thanks,
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-18 11:58 ` Jan Kratochvil
@ 2012-09-18 12:21 ` Eli Zaretskii
2012-09-18 13:54 ` Joel Brobecker
2012-09-18 15:38 ` Khoo Yit Phang
1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2012-09-18 12:21 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: brobecker, khooyp, gdb-patches
> Date: Tue, 18 Sep 2012 13:58:14 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> Cc: Joel Brobecker <brobecker@adacore.com>, khooyp@cs.umd.edu, gdb-patches@sourceware.org
>
> On Tue, 18 Sep 2012 08:17:29 +0200, Eli Zaretskii wrote:
> > Is it possible to make GDB find its data-directory when it is run from
> > the directory where it was built?
>
> relocate_gdb_directory call could be adjusted to handle data-directory also in
> the GDB build directory.
That'd be nice, thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-18 12:21 ` Eli Zaretskii
@ 2012-09-18 13:54 ` Joel Brobecker
0 siblings, 0 replies; 16+ messages in thread
From: Joel Brobecker @ 2012-09-18 13:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Jan Kratochvil, khooyp, gdb-patches
> > relocate_gdb_directory call could be adjusted to handle
> > data-directory also in the GDB build directory.
>
> That'd be nice, thanks.
Yes, I agree :).
--
Joel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-18 11:58 ` Jan Kratochvil
2012-09-18 12:21 ` Eli Zaretskii
@ 2012-09-18 15:38 ` Khoo Yit Phang
2012-09-18 15:44 ` Jan Kratochvil
1 sibling, 1 reply; 16+ messages in thread
From: Khoo Yit Phang @ 2012-09-18 15:38 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Khoo Yit Phang, Eli Zaretskii, Joel Brobecker, gdb-patches
Hi,
On Sep 18, 2012, at 7:58 AM, Jan Kratochvil wrote:
> On Tue, 18 Sep 2012 08:17:29 +0200, Eli Zaretskii wrote:
>> Is it possible to make GDB find its data-directory when it is run from
>> the directory where it was built?
>
> relocate_gdb_directory call could be adjusted to handle data-directory also in
> the GDB build directory.
If I understand relocate_gdb_directory, it already tries to relocate data-directory from /usr/local/share/gdb (GDB_DATADIR on my config) to build-directory/gdb/../share/gdb. Could we move the build-directory/gdb/data-directory there?
Otherwise, do you mean to change relocate_gdb_directory to specially check for GDB_DATADIR and replace it with buiid-directory/gdb/data-directory? That could lead to the odd possibility that an installed GDB would look for data-directory in a stray build directory. I suppose this can be prevented by checking if gdb_program_name is itself located in build-directory.
Yit
September 18, 2012
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-18 15:38 ` Khoo Yit Phang
@ 2012-09-18 15:44 ` Jan Kratochvil
0 siblings, 0 replies; 16+ messages in thread
From: Jan Kratochvil @ 2012-09-18 15:44 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: Eli Zaretskii, Joel Brobecker, gdb-patches
On Tue, 18 Sep 2012 17:37:40 +0200, Khoo Yit Phang wrote:
> If I understand relocate_gdb_directory, it already tries to relocate
> data-directory from /usr/local/share/gdb (GDB_DATADIR on my config) to
> build-directory/gdb/../share/gdb. Could we move the
> build-directory/gdb/data-directory there?
No.
> Otherwise, do you mean to change relocate_gdb_directory to specially check
> for GDB_DATADIR and replace it with buiid-directory/gdb/data-directory? That
> could lead to the odd possibility that an installed GDB would look for
> data-directory in a stray build directory. I suppose this can be prevented
> by checking if gdb_program_name is itself located in build-directory.
Installed GDB will have path /usr/bin/gdb and I find OK if GDB checks that
/usr/bin/data-directory/ does not exist.
Thanks,
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-17 21:04 ` Khoo Yit Phang
@ 2012-09-18 20:40 ` Khoo Yit Phang
2012-09-22 13:30 ` Jan Kratochvil
0 siblings, 1 reply; 16+ messages in thread
From: Khoo Yit Phang @ 2012-09-18 20:40 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: Joel Brobecker, Jan Kratochvil, GDB Patches
Hi,
On Sep 17, 2012, at 5:04 PM, Khoo Yit Phang wrote:
> Hi,
>
> On Sep 17, 2012, at 4:58 PM, Joel Brobecker wrote:
>
>>> If you are running GDB from the build directory, please run gdb with
>>> the -data-directory flag set as appropriate, e.g., "builddir/gdb
>>> -data-directory builddir/data-directory".
>>
>> I expect that the majority of users will *not* be running GDB out
>> of the build directory. If they encounter the same issue with a
>> poorly installed GDB (Eg: They copied the GDB binary from one location
>> to another without copying the remaining support files), the error
>> message is not going to help them.
>>
>> I think that people who do run GDB from the build directory (a power
>> user setup) should be sufficiently knowledgeable, and we should try
>> to tailor the hints towards regular users.
>
> Perhaps:
>
> GDB is unable to find its support files. You may need to provide the -data-directory flag to GDB (refer to the man pages for more details).
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).
Yit
September 18, 2012
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-18 20:40 ` Khoo Yit Phang
@ 2012-09-22 13:30 ` Jan Kratochvil
2012-09-22 18:37 ` Khoo Yit Phang
0 siblings, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2012-09-22 13:30 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: Joel Brobecker, GDB Patches
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-22 13:30 ` Jan Kratochvil
@ 2012-09-22 18:37 ` Khoo Yit Phang
2012-10-06 20:56 ` Ping! " Khoo Yit Phang
0 siblings, 1 reply; 16+ messages in thread
From: Khoo Yit Phang @ 2012-09-22 18:37 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Khoo Yit Phang, GDB Patches
[-- Attachment #1: Type: text/plain, Size: 823 bytes --]
Hi Jan,
On Sep 22, 2012, at 9:30 AM, Jan Kratochvil wrote:
> ------------------------------------------------------------------------------
> 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"
> ------------------------------------------------------------------------------
Thanks for pointing out this style, it looks good to me, and it's nice to be consistent. I've updated my patch with it.
Yit
September 22, 2012
[-- Attachment #2: warn-gdb-python-compat.txt --]
[-- Type: text/plain, Size: 949 bytes --]
gdb/ChangeLog
2012-09-22 Khoo Yit Phang <khooyp@cs.umd.edu>
* gdb/python.c (finish_python_initialization): Augment the warning
when importing "gdb" fails, to check that data-directory is set
correctly.
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1506,7 +1506,12 @@
gdbpy_print_stack ();
warning (_("Could not load the Python gdb module from `%s'."),
gdb_pythondir);
- warning (_("Limited Python support is available from the _gdb module."));
+ printf_filtered(_("\
+You may need to provide the -data-directory flag to GDB.\n\
+Limited Python support is available from the _gdb module.\n\
+For more information about GDB dependencies on external files\n\
+see the \"Data Files\" section in the GDB manual. E.g., run from the shell:\n\
+\tinfo \"(gdb)Data Files\"\n"));
do_cleanups (cleanup);
return;
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* Ping! Re: [PATCH] Warn about data-directory when failing to import Python "gdb" module
2012-09-22 18:37 ` Khoo Yit Phang
@ 2012-10-06 20:56 ` Khoo Yit Phang
0 siblings, 0 replies; 16+ messages in thread
From: Khoo Yit Phang @ 2012-10-06 20:56 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: Jan Kratochvil, GDB Patches
Hi,
Any concerns about this patch? Shall I check it in?
Yit
October 6, 2012
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-10-06 20:56 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17 19:36 [PATCH] Warn about data-directory when failing to import Python "gdb" module Khoo Yit Phang
2012-09-17 20:23 ` Jan Kratochvil
2012-09-17 20:28 ` Khoo Yit Phang
2012-09-17 20:36 ` Jan Kratochvil
2012-09-17 20:58 ` Joel Brobecker
2012-09-17 21:04 ` Khoo Yit Phang
2012-09-18 20:40 ` Khoo Yit Phang
2012-09-22 13:30 ` Jan Kratochvil
2012-09-22 18:37 ` Khoo Yit Phang
2012-10-06 20:56 ` Ping! " Khoo Yit Phang
2012-09-18 6:17 ` Eli Zaretskii
2012-09-18 11:58 ` Jan Kratochvil
2012-09-18 12:21 ` Eli Zaretskii
2012-09-18 13:54 ` Joel Brobecker
2012-09-18 15:38 ` Khoo Yit Phang
2012-09-18 15:44 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox