Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Missing new inferior notification for core files
@ 2009-05-05 20:15 Marc Khouzam
  2009-05-05 20:28 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Khouzam @ 2009-05-05 20:15 UTC (permalink / raw)
  To: gdb

Hi,

with HEAD of April 30th, I noticed that there is no notification
of a new inferior when connecting to a core file.  This is on Linux.

Note that the session below uses MI, but I also tried
plain CLI and used 'set print inferior-events 1';
in that case still, no [New inferior ] event was shown.
So, inferior.c#add_inferior() does not seem to get called for a core
file.

This causes a problem for DSF-GDB because it is not made
aware that a new inferior must be shown to the user.

Maybe this is a simple fix that can get in before branch time for 7.0?

Thanks in advance

marc



~"GNU gdb (GDB) 6.8.50.20090430-cvs\n"
~"Copyright (C) 2009 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show
copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>...\n"
(gdb) 
info inferior
&"info inferior\n"
^done

== No inferiors yet, ok ==

(gdb) 
target core /local/home/lmckhou/core.28170
&"target core /local/home/lmckhou/core.28170\n"
=thread-created,id="1",group-id="1"

== thread-created event, but no thread-group-created event ==

&"warning: Can't read pathname for load map: Input/output error.\n"
=library-loaded,id="/lib/libpthread.so.0",target-name="/lib/libpthread.s
o.0",host-name="/lib/libpthread.so.0",symbols-loaded="0"
=library-loaded,id="/usr/lib/libstdc++.so.6",target-name="/usr/lib/libst
dc++.so.6",host-name="/usr/lib/libstdc++.so.6",symbols-loaded="0"
=library-loaded,id="/lib/libm.so.6",target-name="/lib/libm.so.6",host-na
me="/lib/libm.so.6",symbols-loaded="0"
=library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1"
,host-name="/lib/libgcc_s.so.1",symbols-loaded="0"
=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-na
me="/lib/libc.so.6",symbols-loaded="0"
=library-loaded,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.2"
,host-name="/lib/ld-linux.so.2",symbols-loaded="0"
~"Reading symbols from /lib/libpthread.so.0..."
~"done.\n"
~"Loaded symbols for /lib/libpthread.so.0\n"
~"Reading symbols from /usr/lib/libstdc++.so.6..."
~"done.\n"
~"Loaded symbols for /usr/lib/libstdc++.so.6\n"
~"Reading symbols from /lib/libm.so.6..."
~"done.\n"
~"Loaded symbols for /lib/libm.so.6\n"
~"Reading symbols from /lib/libgcc_s.so.1..."
~"done.\n"
~"Loaded symbols for /lib/libgcc_s.so.1\n"
~"Reading symbols from /lib/libc.so.6..."
~"done.\n"
~"Loaded symbols for /lib/libc.so.6\n"
~"Reading symbols from /lib/ld-linux.so.2..."
~"done.\n"
~"Loaded symbols for /lib/ld-linux.so.2\n"
&"Failed to read a valid object file image from memory.\n"
~"Core was generated by
`/local/home/lmckhou/runtime-TestDSF/DSFTEstApp/Debug/DSFTEstApp'.\n"
~"Program terminated with signal 5, Trace/breakpoint trap.\n"
~"#0  main () at ../testapp.cc:503\n"
~"503\t\tint de = 99;\n"
^done
(gdb) 
info inferior
&"info inferior\n"
~"* 1 1\n"
^done

== Inferior is in the list (granted, it is a special one) ==
== but there was no event for its addition ==

(gdb) 
-gdb-exit
^exit
=thread-group-exited,id="1"

== thread-group-exited event but no corresponding ==
== thread-group created before ==

=library-unloaded,id="/lib/libpthread.so.0",target-name="/lib/libpthread
.so.0",host-name="/lib/libpthread.so.0"
=library-unloaded,id="/usr/lib/libstdc++.so.6",target-name="/usr/lib/lib
stdc++.so.6",host-name="/usr/lib/libstdc++.so.6"
=library-unloaded,id="/lib/libm.so.6",target-name="/lib/libm.so.6",host-
name="/lib/libm.so.6"
=library-unloaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.
1",host-name="/lib/libgcc_s.so.1"
=library-unloaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-
name="/lib/libc.so.6"
=library-unloaded,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.
2",host-name="/lib/ld-linux.so.2"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Missing new inferior notification for core files
  2009-05-05 20:15 Missing new inferior notification for core files Marc Khouzam
@ 2009-05-05 20:28 ` Pedro Alves
  2009-05-05 20:38   ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2009-05-05 20:28 UTC (permalink / raw)
  To: gdb; +Cc: Marc Khouzam

A Tuesday 05 May 2009 21:15:23, Marc Khouzam wrote:

> with HEAD of April 30th, I noticed that there is no notification
> of a new inferior when connecting to a core file.  This is on Linux.
> 
> Note that the session below uses MI, but I also tried
> plain CLI and used 'set print inferior-events 1';
> in that case still, no [New inferior ] event was shown.
> So, inferior.c#add_inferior() does not seem to get called for a core
> file.
>
> This causes a problem for DSF-GDB because it is not made
> aware that a new inferior must be shown to the user.

The observer_notify_new_inferior call should move from add_inferior
to add_inferior_silent.  corelow.c:core_open should probably also
be made a bit smarter to only delay adding the new inferior until
the pid of the core file is known.  As is currently, on some targets,
(e.g., solaris), the thread group's target pid will always start
as `1' and immediately changes to the pid the process had when it
crashed,  if that pid is retrievable (although the gdb inferior id
never changes) --- there's no defined MI notification for this id
change.  This last bit doesn't currently affect linux though.

> Maybe this is a simple fix that can get in before branch time for 7.0?

Patch and/or a bugzilla PR is welcome.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Missing new inferior notification for core files
  2009-05-05 20:28 ` Pedro Alves
@ 2009-05-05 20:38   ` Pedro Alves
  2009-05-06 13:45     ` Marc Khouzam
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2009-05-05 20:38 UTC (permalink / raw)
  To: gdb; +Cc: Marc Khouzam

On Tuesday 05 May 2009 21:29:01, Pedro Alves wrote:
> A Tuesday 05 May 2009 21:15:23, Marc Khouzam wrote:

> > Maybe this is a simple fix that can get in before branch time for 7.0?
> 
> Patch and/or a bugzilla PR is welcome.

On second thought, this way is simpler.  Try this.  I'm giving it a
testsuite spin.  We'll handle the inferior pid change later.

-- 
Pedro Alves

---
 gdb/inferior.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: src/gdb/inferior.c
===================================================================
--- src.orig/gdb/inferior.c	2009-05-05 21:34:08.000000000 +0100
+++ src/gdb/inferior.c	2009-05-05 21:34:34.000000000 +0100
@@ -84,6 +84,8 @@ add_inferior_silent (int pid)
   inf->next = inferior_list;
   inferior_list = inf;
 
+  observer_notify_new_inferior (pid);
+
   return inf;
 }
 
@@ -92,8 +94,6 @@ add_inferior (int pid)
 {
   struct inferior *inf = add_inferior_silent (pid);
 
-  observer_notify_new_inferior (pid);
-
   if (print_inferior_events)
     printf_unfiltered (_("[New inferior %d]\n"), pid);
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Missing new inferior notification for core files
  2009-05-05 20:38   ` Pedro Alves
@ 2009-05-06 13:45     ` Marc Khouzam
  2009-05-06 17:27       ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Khouzam @ 2009-05-06 13:45 UTC (permalink / raw)
  To: Pedro Alves, gdb

> -----Original Message-----
> From: gdb-owner@sourceware.org 
> [mailto:gdb-owner@sourceware.org] On Behalf Of Pedro Alves
> Sent: Tuesday, May 05, 2009 4:39 PM
> To: gdb@sourceware.org
> Cc: Marc Khouzam
> Subject: Re: Missing new inferior notification for core files
> 
> On Tuesday 05 May 2009 21:29:01, Pedro Alves wrote:
> > A Tuesday 05 May 2009 21:15:23, Marc Khouzam wrote:
> 
> > > Maybe this is a simple fix that can get in before branch 
> time for 7.0?
> > 
> > Patch and/or a bugzilla PR is welcome.

My apologies about not providing such a simple fix myself.
To be honnest, I hadn't realized it would be soooo easy.

> On second thought, this way is simpler.  Try this.  I'm giving it a
> testsuite spin.  We'll handle the inferior pid change later.

Of course, this worked great.

Thanks!

> 
> -- 
> Pedro Alves
> 
> ---
>  gdb/inferior.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: src/gdb/inferior.c
> ===================================================================
> --- src.orig/gdb/inferior.c	2009-05-05 21:34:08.000000000 +0100
> +++ src/gdb/inferior.c	2009-05-05 21:34:34.000000000 +0100
> @@ -84,6 +84,8 @@ add_inferior_silent (int pid)
>    inf->next = inferior_list;
>    inferior_list = inf;
>  
> +  observer_notify_new_inferior (pid);
> +
>    return inf;
>  }
>  
> @@ -92,8 +94,6 @@ add_inferior (int pid)
>  {
>    struct inferior *inf = add_inferior_silent (pid);
>  
> -  observer_notify_new_inferior (pid);
> -
>    if (print_inferior_events)
>      printf_unfiltered (_("[New inferior %d]\n"), pid);
>  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Missing new inferior notification for core files
  2009-05-06 13:45     ` Marc Khouzam
@ 2009-05-06 17:27       ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2009-05-06 17:27 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: gdb

On Wednesday 06 May 2009 14:45:22, Marc Khouzam wrote:

> My apologies about not providing such a simple fix myself.
> To be honnest, I hadn't realized it would be soooo easy.

:-)  Not a problem.  Thanks for reporting.

> > On second thought, this way is simpler.  Try this.  I'm giving it a
> > testsuite spin.  We'll handle the inferior pid change later.
> 
> Of course, this worked great.

Good, I've checked it in.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-05-06 17:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-05 20:15 Missing new inferior notification for core files Marc Khouzam
2009-05-05 20:28 ` Pedro Alves
2009-05-05 20:38   ` Pedro Alves
2009-05-06 13:45     ` Marc Khouzam
2009-05-06 17:27       ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox