This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

GDB 5.0: Errors building on HPUX 10.01


GDB Maintainers,

   I found the following problems while building GDB 5.0 on (the aging)
   HPUX 10.01 (hppa1.1-hp-hpux10.01).

   Background: I found the following note in configure.in which may be
   related to the problems or a solution(s).  Lines 155 through 173:

># The following save_state_t checkery is only necessary for HPUX 
># versions earlier than 10.20.  When those fade from memory, this 
># could be expunged. --jsm 1999-03-22
>
>AC_MSG_CHECKING(for HPUX save_state structure)
>AC_EGREP_HEADER(save_state_t, machine/save_state.h, 
>                gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
>AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
>                gdb_cv_hpux_sswide=no)
>if test $gdb_cv_hpux_savestate = yes
>then
>  AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
>fi
>if test $gdb_cv_hpux_sswide = yes
>then
>  AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
>fi
>AC_MSG_RESULT($gdb_cv_hpux_sswide)

On my HPUX 10.01 the struct members 'ss_wide' and 'ss_narrow' are NOT
defined, and so 'config.h' has the following comment at lines 121
through 125:

>/* Set to true if the save_state_t structure is present */
>#define HAVE_STRUCT_SAVE_STATE_T 1
>
>/* Set to true if the save_state_t structure has the ss_wide member */
>/* #undef HAVE_STRUCT_MEMBER_SS_WIDE */

  Problem #1: gdb-5.0/gdb/hppa-tdep.c, lines 2673 through 2682

>  /* Code below copied from hppah-nat.c, with fixes for wide
>     registers, using different area of save_state, etc. */
>  if (regnum == FLAGS_REGNUM || regnum >= FP0_REGNUM ||
>      !HAVE_STRUCT_SAVE_STATE_T || !HAVE_STRUCT_MEMBER_SS_WIDE)
>    {
>      /* Use narrow regs area of save_state and default macro. */
>      offset = U_REGS_OFFSET;
>      regaddr = register_addr (regnum, offset);
>      start = 1;
>    }

Of course, when 'HAVE_STRUCT_MEMBER_SS_WIDE' is undefined, this code
has a parsing error in the if () expression.  A possible simple fix is
to use the preprocessor decision to create a C code decision:

>int struct_test; /* Flag for testing structs */
>struct_test = 0;
>
>#ifndef HAVE_STRUCT_SAVE_STATE_T
>  struct_test = 1; /* TRUE */
>#endif
>#ifndef HAVE_STRUCT_MEMBER_SS_WIDE
>  struct_test = 1; /* TRUE */
>#endif
>  
>  if (regnum == FLAGS_REGNUM || regnum >= FP0_REGNUM || struct_test)
>    {
>      /* Use narrow regs area of save_state and default macro. */
>      offset = U_REGS_OFFSET;
>      regaddr = register_addr (regnum, offset);
>      start = 1;
>    }

   Problem #2: gdb-5.0/gdb/hppah-nat.c, lines 96 through 109:

>   /* Wide registers come from the ss_wide area.
>      I think it's more PC to test (ss_flags & SS_WIDEREGS) to select
>      between ss_wide and ss_narrow than to use the raw register size.
>      But checking ss_flags would require an extra ptrace call for
>      every register reference.  Bleah.  */
>   else if (len == 8)
>      addr = (HPPAH_OFFSETOF (save_state_t, ss_wide) 
>             + REGISTER_BYTE (regno));
>
>   /* Narrow registers come from the ss_narrow area.  Note that
>	   ss_narrow starts with gr1, not gr0.  */
>   else if (len == 4)
>      addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)
>             + (REGISTER_BYTE (regno) - REGISTER_BYTE (1)));

Of course, the references to 'ss_wide' and 'ss_narrow' need to be
tested in some way to be sure these structure members exists; that was
the purpose of the configure.in code above.  I am not sure what is the
best way to fix this code, but the following quick change might be all
that is needed.  (It assumes that if the 'ss_wide' structure member is
defined, then the 'ss_narrow' member is defined, too.)

>#ifdef HAVE_STRUCT_MEMBER_SS_WIDE
>   /* Wide registers come from the ss_wide area.
>      I think it's more PC to test (ss_flags & SS_WIDEREGS) to select
>      between ss_wide and ss_narrow than to use the raw register size.
>      But checking ss_flags would require an extra ptrace call for
>      every register reference.  Bleah.  */
>   else if (len == 8)
>      addr = (HPPAH_OFFSETOF (save_state_t, ss_wide) 
>             + REGISTER_BYTE (regno));
>
>   /* Narrow registers come from the ss_narrow area.  Note that
>	   ss_narrow starts with gr1, not gr0.  */
>   else if (len == 4)
>      addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)
>             + (REGISTER_BYTE (regno) - REGISTER_BYTE (1)));
>#endif

After I made the changes listed above, I was able to build, install,
and run gdb-5.0 on HPUX 10.01.

-- 
## Mark Harig
## Landmark Systems, Reston, Virginia, USA
## Email: mharig@landmark.com

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