This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/rs6000-aix] software_single_step gdbarch method no longer set


Hello,

I noticed the following problem shortly after having attached my
debugger to a program:

        (gdb) n
        ptrace: I/O error.
        pck.break_me (param=117) at pck.adb:18
        18            Variable := Param + 1;

I traced the problem to the following piece of code:

   if (from_xcoff_exec)
     {
       /* NOTE: jimix/2003-06-09: This test should really check for
         GDB_OSABI_AIX when that is defined and becomes
         available. (Actually, once things are properly split apart,
         the test goes away.) */
        /* RS6000/AIX does not support PT_STEP.  Has to be simulated.  */
        set_gdbarch_software_single_step (gdbarch, rs6000_software_single_step);
     }

Normally, for AIX, we need to enable software_single_step, and this is
what the above code is trying to do. However, things do not go as expected.
Here is what happens:

At startup, the debugger initializes itself, and rs6000_gdbarch_init()
is called a first time (due to arch-utils's init phase). Because we have
not looked at the executable yet, the OSABI is unknown.  We end up creating
a default gdbarch vector where software_single_step is not set. This vector
is then stored by the gdbarch module into its store.

Second step, we're then re-initializing the gdbarch vector again, this
time using our executable. Unfortunately, the creation a new gdbarch
is cut short by:

  for (arches = gdbarch_list_lookup_by_info (arches, &info);
       arches != NULL;
       arches = gdbarch_list_lookup_by_info (arches->next, &info))
    {
      /* Word size in the various PowerPC bfd_arch_info structs isn't
         meaningful, because 64-bit CPUs can run in 32-bit mode.  So, perform
         separate word size check.  */
      tdep = gdbarch_tdep (arches->gdbarch);
      if (tdep && tdep->wordsize == wordsize)
        return arches->gdbarch;
    }

We do not have a sniffer for AIX binaries, and hence the osabi is
again unknown, and the search above ends up reselecting the gdbarch
vector we previously created, with among other things the incorrect
value for software_single_step.

The solution was to create a new osabi enum GDB_OSABI_AIX, and add
a sniffer. Because I like things well organized, I put the aix-specific
stuff in a separate (new) file, rs6000-aix-tdep.c. I also took care
of the NOTE introduced by jimix.

This the patch proposed below, the testsuite now runs to completion
in about 15min on our machine, as opposed to timing out to death.
Results are not stellar, but reasonably ok for a platform that gets
only little attention. Quite a few failures are because we do not
have g++ available.

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

        * defs.h (gdb_osabi): New enum value GDB_OSABI_AIX.
        * osabi.c (gdb_osabi_name): Add name of new value GDB_OSABI_AIX.
        * rs6000-tdep.h: New file.
        * rs6000-tdep.c: Include "rs6000-tdep.h".
        (rs6000_gdbarch_init): Remove enabling of software single step.
        Will be done in the AIX-specific initialization routine.
        * rs6000-aix-tdep.c: New file.
        * config/powerpc/aix.mt (TDEPFILES): Add rs6000-aix-tdep.o.
        * Makefile.in (rs6000_tdep_h): New variable.
        (rs6000-tdep.o): Update dependencies.
        (rs6000-aix-tdep.o): New rule.

OK to commit?

Given that the debugger is severly broken without this change, perhaps
we should port it to the 6.4 branch as well. Not sure yet if it will be
worth doing a 6.4.1 or a 6.5, but we might want to have this change
available in the branch should we make a followup release off it.

Thanks,
-- 
Joel

Attachment: sss.diff
Description: Text document

Attachment: rs6000-tdep.h
Description: Text document

Attachment: rs6000-aix-tdep.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]