Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/commit] Internal error while loading core on alpha-tru64
@ 2009-12-31  7:03 Joel Brobecker
  2009-12-31  7:51 ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2009-12-31  7:03 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

Hello,

There is an internal-error due to GDB not being able to find
the inferior address space when trying to load a core file on
alpha-tru64.

The core file is for a program that does not use threads. The name
of the section where the registers is saved is .reg.  core_open
prefers .reg/NN rather than .reg, and has some special code to
handle the case where no .reg/NN section was found.

      /* Either we found no .reg/NN section, and hence we have a
         non-threaded core (single-threaded, from gdb's perspective),
         or for some reason add_to_thread_list couldn't determine
         which was the "main" thread.  The latter case shouldn't
         usually happen, but we're dealing with input here, which can
         always be broken in different ways.  */
       struct thread_info *thread = first_thread_of_process (-1);
       if (thread == NULL)
        {
          add_inferior_silent (CORELOW_PID);
          inferior_ptid = pid_to_ptid (CORELOW_PID);
          add_thread_silent (inferior_ptid);
        }
The problem is that the code above is it is using add_inferior_silent.
As a result, we end up with a second inferior in our list (which I do
not think is expected), and also this new inferior has no program or
address space.

The fix I applied was to replace the call to add_inferior_silent
by a call to inferior_appeared...  I think that this was the right
thing to do.

2009-12-31  Joel Brobecker  <brobecker@adacore.com>

        Internal error while loading core on alpha-tru64.
        * corelow.c (core_open): Delete unused local variables.
        Use inferior_appeared instead of add_inferior_silent.

Tested on alpha-tru64 with the AdaCore gdb-testsuite (I can no longer
run the dejagnu testsuite on this platform).  This is the only platform
where I observed this issue.

Will commit in a few days unless there are any objections.

-- 
Joel

[-- Attachment #2: corelow.diff --]
[-- Type: text/x-diff, Size: 1037 bytes --]

commit da99585b71b9646f9468e1f6aff00c9fcd18202b
Author: brobecke <brobecke@f8352e7e-cb20-0410-8ce7-b5d9e71c585c>
Date:   Thu Dec 31 06:25:05 2009 +0000

    Internal error while loading core on alpha-tru64.
    
            * corelow.c (core_open): Delete unused local variables.
            Use inferior_appeared instead of add_inferior_silent.
    
    
diff --git a/gdb/corelow.c b/gdb/corelow.c
index d0eada6..15ecd2d 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -302,8 +302,6 @@ core_open (char *filename, int from_tty)
   bfd *temp_bfd;
   int scratch_chan;
   int flags;
-  int corelow_pid = CORELOW_PID;
-  struct inferior *inf;
 
   target_preopen (from_tty);
   if (!filename)
@@ -423,7 +421,7 @@ core_open (char *filename, int from_tty)
       struct thread_info *thread = first_thread_of_process (-1);
       if (thread == NULL)
 	{
-	  add_inferior_silent (CORELOW_PID);
+	  inferior_appeared (current_inferior (), CORELOW_PID);
 	  inferior_ptid = pid_to_ptid (CORELOW_PID);
 	  add_thread_silent (inferior_ptid);
 	}

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

* Re: [RFA/commit] Internal error while loading core on alpha-tru64
  2009-12-31  7:03 [RFA/commit] Internal error while loading core on alpha-tru64 Joel Brobecker
@ 2009-12-31  7:51 ` Pedro Alves
  2009-12-31 10:59   ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2009-12-31  7:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

On Thursday 31 December 2009 07:02:24, Joel Brobecker wrote:

> The fix I applied was to replace the call to add_inferior_silent
> by a call to inferior_appeared...  I think that this was the right
> thing to do.

It is, thanks for catching.

> 2009-12-31  Joel Brobecker  <brobecker@adacore.com>
> 
>         Internal error while loading core on alpha-tru64.
>         * corelow.c (core_open): Delete unused local variables.
>         Use inferior_appeared instead of add_inferior_silent.

This is OK.

> Tested on alpha-tru64 with the AdaCore gdb-testsuite (I can no longer
> run the dejagnu testsuite on this platform).

(You don't actually need to be able to run dejagnu on the
platform--- you should give remote host testing a try
sometime.)

> This is the only platform where I observed this issue.

Should have affected OpenBSD too, I think.

-- 
Pedro Alves


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

* Re: [RFA/commit] Internal error while loading core on alpha-tru64
  2009-12-31  7:51 ` Pedro Alves
@ 2009-12-31 10:59   ` Joel Brobecker
  2009-12-31 17:14     ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2009-12-31 10:59 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> > 2009-12-31  Joel Brobecker  <brobecker@adacore.com>
> > 
> >         Internal error while loading core on alpha-tru64.
> >         * corelow.c (core_open): Delete unused local variables.
> >         Use inferior_appeared instead of add_inferior_silent.
> 
> This is OK.

Cool, now checked in. Thanks for the quick review!

> > Tested on alpha-tru64 with the AdaCore gdb-testsuite (I can no longer
> > run the dejagnu testsuite on this platform).
> 
> (You don't actually need to be able to run dejagnu on the
> platform--- you should give remote host testing a try
> sometime.)

I would love to try it. Are there some instructions available anywhere,
in the wiki, perhaps?

Thanks,
-- 
Joel


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

* Re: [RFA/commit] Internal error while loading core on alpha-tru64
  2009-12-31 10:59   ` Joel Brobecker
@ 2009-12-31 17:14     ` Pedro Alves
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2009-12-31 17:14 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Thursday 31 December 2009 10:58:26, Joel Brobecker wrote:
> > > 2009-12-31  Joel Brobecker  <brobecker@adacore.com>
> > > 
> > >         Internal error while loading core on alpha-tru64.
> > >         * corelow.c (core_open): Delete unused local variables.
> > >         Use inferior_appeared instead of add_inferior_silent.
> > 
> > This is OK.
> 
> Cool, now checked in. Thanks for the quick review!
> 
> > > Tested on alpha-tru64 with the AdaCore gdb-testsuite (I can no longer
> > > run the dejagnu testsuite on this platform).
> > 
> > (You don't actually need to be able to run dejagnu on the
> > platform--- you should give remote host testing a try
> > sometime.)
> 
> I would love to try it. Are there some instructions available anywhere,
> in the wiki, perhaps?

I don't think so, but it would be nice to have.  The dejagnu manual has
a short section about it though.  A useful trick is to have a
shared filesystem between the build and host (e.g., mounting the
build filesystem with nfs/smb on the host), as
hinted by Joseph <http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00163.html>

-- 
Pedro Alves


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

end of thread, other threads:[~2009-12-31 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-31  7:03 [RFA/commit] Internal error while loading core on alpha-tru64 Joel Brobecker
2009-12-31  7:51 ` Pedro Alves
2009-12-31 10:59   ` Joel Brobecker
2009-12-31 17:14     ` Pedro Alves

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