* [patch] python: load *-gdb.py for shlibs during attach
@ 2010-09-22 16:20 Jan Kratochvil
2010-09-22 19:41 ` Tom Tromey
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2010-09-22 16:20 UTC (permalink / raw)
To: gdb-patches
Hi,
currently if you attach to or load a core file for executable, its -gdb.py
script is loaded. But none -gdb.py for the shared libraries.
Spawned or with the fix (libstdc++-gdb.py):
#1 0x00000000004007b5 in f (s="a") at 1.C:4
^ is std::string
Attached/core without the fix:
#1 0x00000000004007b5 in f (s=...) at 1.C:4
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
Mostly obvious, I will check it in later.
Thanks,
Jan
gdb/
2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* main.c: Include objfiles.h.
(captured_main): New variable objfile. Call
load_auto_scripts_for_objfile for ALL_OBJFILES.
--- ./gdb/main.c 2010-09-22 10:51:32.000000000 +0200
+++ ./gdb/main.c 2010-09-22 10:50:44.000000000 +0200
@@ -43,6 +43,7 @@
#include "source.h"
#include "cli/cli-cmds.h"
#include "python/python.h"
+#include "objfiles.h"
/* The selected interpreter. This will be used as a set command
variable, so it should always be malloc'ed - since
@@ -323,6 +324,7 @@ captured_main (void *data)
int i;
int save_auto_load;
+ struct objfile *objfile;
struct cleanup *pre_stat_chain = make_command_stats_cleanup (0);
@@ -957,8 +959,8 @@ Can't attach to process and specify a co
We wait until now because it is common to add to the source search
path in local_gdbinit. */
gdbpy_global_auto_load = save_auto_load;
- if (symfile_objfile != NULL)
- load_auto_scripts_for_objfile (symfile_objfile);
+ ALL_OBJFILES (objfile)
+ load_auto_scripts_for_objfile (objfile);
for (i = 0; i < ncmd; i++)
{
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] python: load *-gdb.py for shlibs during attach
2010-09-22 16:20 [patch] python: load *-gdb.py for shlibs during attach Jan Kratochvil
@ 2010-09-22 19:41 ` Tom Tromey
2010-09-22 19:51 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2010-09-22 19:41 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> currently if you attach to or load a core file for executable, its
Jan> -gdb.py script is loaded. But none -gdb.py for the shared
Jan> libraries.
Jan> 2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Jan> * main.c: Include objfiles.h.
Jan> (captured_main): New variable objfile. Call
Jan> load_auto_scripts_for_objfile for ALL_OBJFILES.
FWIW, I agree this is the right thing to do.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] python: load *-gdb.py for shlibs during attach
2010-09-22 19:41 ` Tom Tromey
@ 2010-09-22 19:51 ` Jan Kratochvil
2010-09-22 20:09 ` Tom Tromey
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2010-09-22 19:51 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Wed, 22 Sep 2010 21:23:00 +0200, Tom Tromey wrote:
> Jan> 2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
> Jan> * main.c: Include objfiles.h.
> Jan> (captured_main): New variable objfile. Call
> Jan> load_auto_scripts_for_objfile for ALL_OBJFILES.
>
> FWIW, I agree this is the right thing to do.
BTW what do you think about the case when the called python scripts would
manipulate the ALL_OBJFILES list? But even ALL_OBJFILES_SAFE would not be
safe enough in such case.
Sure it could be protected some other way like to lookup again the saved
objfile name. But it can also deadlock. I guess there are more places like
that in GDB.
Regards,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] python: load *-gdb.py for shlibs during attach
2010-09-22 19:51 ` Jan Kratochvil
@ 2010-09-22 20:09 ` Tom Tromey
2010-09-22 21:33 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2010-09-22 20:09 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> BTW what do you think about the case when the called python scripts would
Jan> manipulate the ALL_OBJFILES list? But even ALL_OBJFILES_SAFE would not be
Jan> safe enough in such case.
I'm inclined not to worry about it.
I guess we could come up with a scheme to make it work. That seems like
a lot of effort for something that, at present, is just a theoretical
problem.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-22 19:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-22 16:20 [patch] python: load *-gdb.py for shlibs during attach Jan Kratochvil
2010-09-22 19:41 ` Tom Tromey
2010-09-22 19:51 ` Jan Kratochvil
2010-09-22 20:09 ` Tom Tromey
2010-09-22 21:33 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).