Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Cc: Jimmy Guo <guo@cup.hp.com>
Subject: Re: (patch) hpjyg21: FAT_FREE_PSYMTABS
Date: Thu, 11 Nov 1999 15:10:00 -0000	[thread overview]
Message-ID: <382B4CD6.4B13DFA1@cygnus.com> (raw)
In-Reply-To: <Pine.LNX.4.10.9911111247400.5596-100000@hpcll168.cup.hp.com>

Maintainers,

I've another meta maintainer question on this :-)

Is it better to use #ifdef or have the compiler eliminate optional
code?  For instance:

	if (FAT_FREE_PSYMTABS)
	  {
	  }

If the compiler does the elimination (instead of CPP) the code is always
being checked and hence less likely to suffer bit rot.

Yes I know it's something of a radical departure from the existing
conventions.

Andrew


> + #ifdef FAT_FREE_PSYMTABS
> +
> +               /* srikanth, in the case of the Wildebeest, the psymtabs could be empty
> +                  and hence the call to find_pc_sect_psymbol() could fail to find anything.
> +                  Due potentially to a combination of bugs in compilers, linkers, loaders,
> +                  editors and debugger engineers :-), sometimes there is an overlap of
> +                  textlow and texthigh values between and multiple psymtabs. As a result,
> +                  if we are handed an address equal to the texthigh or textlow, we could
> +                  end up identifying the wrong psymtab.
> +
> +                  To be absolutely sure of the identity of the psymtab, let us verify that
> +                  the one we narrow down on, also houses pc + 4.
> +                */
> +
> +               if (p == NULL)
> +                 {
> +                   CORE_ADDR pc_plus4 = pc + 4;
> +                   if (pc_plus4 >= tpst->textlow &&
> +                       pc_plus4 <= tpst->texthigh)
> +                     return tpst;
> +                 }
> + #endif
From shebs@cygnus.com Thu Nov 11 15:41:00 1999
From: Stan Shebs <shebs@cygnus.com>
To: cagney@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com, guo@cup.hp.com
Subject: Re: (patch) hpjyg21: FAT_FREE_PSYMTABS
Date: Thu, 11 Nov 1999 15:41:00 -0000
Message-id: <199911112341.PAA29252@andros.cygnus.com>
References: <382B4CD6.4B13DFA1@cygnus.com>
X-SW-Source: 1999-q4/msg00238.html
Content-length: 1094

   Date: Fri, 12 Nov 1999 10:10:14 +1100
   From: Andrew Cagney <ac131313@cygnus.com>

   I've another meta maintainer question on this :-)

   Is it better to use #ifdef or have the compiler eliminate optional
   code?  For instance:

	   if (FAT_FREE_PSYMTABS)
	     {
	     }

I favor this over ifdefs.  Not only does it facilitate maintenance,
but it leaves open options for cross-debugging and for making
decisions at runtime.  The only reasonable exception would be provably
time-critical code where ifdefs would allow compiler optimizations not
available if the code were merely "if (0)".  (There might be examples
of this in the stabs reader, although I don't know of any myself.)

   If the compiler does the elimination (instead of CPP) the code is always
   being checked and hence less likely to suffer bit rot.

   Yes I know it's something of a radical departure from the existing
   conventions.

A departure from habit, true, but there's not a rule that says "use
more ifdefs".  Ifdefs are the easy way out, but we want to go the
right way, not the expedient way.

								Stan
From ac131313@cygnus.com Thu Nov 11 15:52:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15: hppah-nat.c & related
Date: Thu, 11 Nov 1999 15:52:00 -0000
Message-id: <382B5609.A4548C6D@cygnus.com>
References: <Pine.LNX.4.10.9911081520150.2309-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00239.html
Content-length: 1445

Jimmy Guo wrote:
> 
> This patch updates hppah-nat.c and related files target.[ch] and
> infrun.c.  See ChangeLog below.
> 
> - Jimmy Guo, guo@cup.hp.com
> 
> ChangeLog
> 
> 1999-11-08      Jimmy Guo       <guo@cup.hp.com>
> 
>         * hppah-nat.c (child_xfer_memory): when reading, also try the
>           other way.
>           (require_notification_of_events): start by ignoring all
>           signals and then adding back in ones we're interested in.
>           (child_has_execd): cache pathname info, used for the 2nd exec
>           event reported by ptrace.
>           (child_pid_to_exec_file): make sure ptrace request for
>           pathname is made after an exec.
> 
>         * target.c (target_signal_exists): New function.  Given a GDB
>           target signal enum, return 1 if it's available on the host.
> 
>         * target.h (target_signal_exists): Declare.

I'd prefer the name (target_signal_p()) (Well actually I don't prefer
that name but its more consistent with the general naming convetion :-).

I'll check in a change to target.[ch] that adds the target_singal_p(). 
Hmm, I might do it slightly differently - were getting too many separate
places where there is code like:

	#if SIG...
	   case TARGET_SIGNAL...
	#endif

With that in, can the hppa-nat.c be re-submitted?  BTW, you might also
split it, I think it contains two changes - the code that uses this new
function and something else.

enjoy,
	Andrew
From ac131313@cygnus.com Thu Nov 11 16:03:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15: hppah-nat.c & related
Date: Thu, 11 Nov 1999 16:03:00 -0000
Message-id: <382B585D.421E98F3@cygnus.com>
References: <Pine.LNX.4.10.9911081520150.2309-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00240.html
Content-length: 25465

Jimmy Guo wrote:
> 
> This patch updates hppah-nat.c and related files target.[ch] and
> infrun.c.  See ChangeLog below.

Jim,

Don't forget that the GDB's coding style is defined by the output of
indent.  Looking more closely I noticed that some of the changes are to
``fix'' the indentation. Please just grit your teath and ignore it.

It's a good idea to carefully review the diffs and revert/remove any
changes not specific to the problem at hand.

Doing this makes the reviewers life so much easier.

	enjoy,
		Andrew


> ***************
> *** 74,80 ****
>         len = REGISTER_RAW_SIZE (regno);
> 
>         /* Requests for register zero actually want the save_state's
> !        ss_flags member.  As RM says: "Oh, what a hack!"  */
>         if (regno == 0)
>         {
>           save_state_t ss;
> --- 74,80 ----
>         len = REGISTER_RAW_SIZE (regno);
> 
>         /* Requests for register zero actually want the save_state's
> !          ss_flags member.  As RM says: "Oh, what a hack!"  */
>         if (regno == 0)
>         {
>           save_state_t ss;
> ***************
> *** 90,109 ****
> 
>         /* Floating-point registers come from the ss_fpblock area.  */
>         else if (regno >= FP0_REGNUM)
> !       addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock)
>                 + (REGISTER_BYTE (regno) - REGISTER_BYTE (FP0_REGNUM)));
> 
>         /* 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)));
> --- 90,109 ----
> 
>         /* Floating-point registers come from the ss_fpblock area.  */
>         else if (regno >= FP0_REGNUM)
> !       addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock)
>                 + (REGISTER_BYTE (regno) - REGISTER_BYTE (FP0_REGNUM)));
> 
>         /* 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)));
> ***************
> *** 112,131 ****
> 
>   #ifdef GDB_TARGET_IS_HPPA_20W
>         /* Unbelieveable.  The PC head and tail must be written in 64bit hunks
> !        or we will get an error.  Worse yet, the oddball ptrace/ttrace
> !        layering will not allow us to perform a 64bit register store.
> 
> !        What a crock.  */
>         if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM && len == 8)
>         {
>           CORE_ADDR temp;
> 
> !         temp = *(CORE_ADDR *)&registers[REGISTER_BYTE (regno)];
> 
>           /* Set the priv level (stored in the low two bits of the PC.  */
>           temp |= 0x3;
> 
> !         ttrace_write_reg_64 (inferior_pid, (CORE_ADDR)addr, (CORE_ADDR)&temp);
> 
>           /* If we fail to write the PC, give a true error instead of
>              just a warning.  */
> --- 112,131 ----
> 
>   #ifdef GDB_TARGET_IS_HPPA_20W
>         /* Unbelieveable.  The PC head and tail must be written in 64bit hunks
> !          or we will get an error.  Worse yet, the oddball ptrace/ttrace
> !          layering will not allow us to perform a 64bit register store.
> 
> !          What a crock.  */
>         if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM && len == 8)
>         {
>           CORE_ADDR temp;
> 
> !         temp = *(CORE_ADDR *) &registers[REGISTER_BYTE (regno)];
> 
>           /* Set the priv level (stored in the low two bits of the PC.  */
>           temp |= 0x3;
> 
> !         ttrace_write_reg_64 (inferior_pid, (CORE_ADDR) addr, (CORE_ADDR) &temp);
> 
>           /* If we fail to write the PC, give a true error instead of
>              just a warning.  */
> ***************
> *** 134,150 ****
>               char *err = safe_strerror (errno);
>               char *msg = alloca (strlen (err) + 128);
>               sprintf (msg, "writing `%s' register: %s",
> !                       REGISTER_NAME (regno), err);
>               perror_with_name (msg);
>             }
>           return;
>         }
> 
>         /* Another crock.  HPUX complains if you write a nonzero value to
> !        the high part of IPSW.  What will it take for HP to catch a
> !        clue about building sensible interfaces?  */
> !      if (regno == IPSW_REGNUM && len == 8)
> !       *(int *)&registers[REGISTER_BYTE (regno)] = 0;
>   #endif
> 
>         for (i = 0; i < len; i += sizeof (int))
> --- 134,150 ----
>               char *err = safe_strerror (errno);
>               char *msg = alloca (strlen (err) + 128);
>               sprintf (msg, "writing `%s' register: %s",
> !                      REGISTER_NAME (regno), err);
>               perror_with_name (msg);
>             }
>           return;
>         }
> 
>         /* Another crock.  HPUX complains if you write a nonzero value to
> !          the high part of IPSW.  What will it take for HP to catch a
> !          clue about building sensible interfaces?  */
> !       if (regno == IPSW_REGNUM && len == 8)
> !       *(int *) &registers[REGISTER_BYTE (regno)] = 0;
>   #endif
> 
>         for (i = 0; i < len; i += sizeof (int))
> ***************
> *** 155,167 ****
>           if (errno != 0)
>             {
>               /* Warning, not error, in case we are attached; sometimes
> !                the kernel doesn't let us at the registers. */
>               char *err = safe_strerror (errno);
>               char *msg = alloca (strlen (err) + 128);
>               sprintf (msg, "writing `%s' register: %s",
> !                       REGISTER_NAME (regno), err);
>               /* If we fail to write the PC, give a true error instead of
> !                just a warning.  */
>               if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
>                 perror_with_name (msg);
>               else
> --- 155,167 ----
>           if (errno != 0)
>             {
>               /* Warning, not error, in case we are attached; sometimes
> !                the kernel doesn't let us at the registers. */
>               char *err = safe_strerror (errno);
>               char *msg = alloca (strlen (err) + 128);
>               sprintf (msg, "writing `%s' register: %s",
> !                      REGISTER_NAME (regno), err);
>               /* If we fail to write the PC, give a true error instead of
> !                just a warning.  */
>               if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
>                 perror_with_name (msg);
>               else
> ***************
> *** 197,212 ****
>         len = sizeof (ss.ss_flags);
> 
>         /* Note that ss_flags is always an int, no matter what
> !        REGISTER_RAW_SIZE(0) says.  Assuming all HP-UX PA machines
> !        are big-endian, put it at the least significant end of the
> !        value, and zap the rest of the buffer.  */
>         offset = REGISTER_RAW_SIZE (0) - len;
>         memset (buf, 0, sizeof (buf));
>       }
> 
>     /* Floating-point registers come from the ss_fpblock area.  */
>     else if (regno >= FP0_REGNUM)
> !     addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock)
>             + (REGISTER_BYTE (regno) - REGISTER_BYTE (FP0_REGNUM)));
> 
>     /* Wide registers come from the ss_wide area.
> --- 197,212 ----
>         len = sizeof (ss.ss_flags);
> 
>         /* Note that ss_flags is always an int, no matter what
> !          REGISTER_RAW_SIZE(0) says.  Assuming all HP-UX PA machines
> !          are big-endian, put it at the least significant end of the
> !          value, and zap the rest of the buffer.  */
>         offset = REGISTER_RAW_SIZE (0) - len;
>         memset (buf, 0, sizeof (buf));
>       }
> 
>     /* Floating-point registers come from the ss_fpblock area.  */
>     else if (regno >= FP0_REGNUM)
> !     addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock)
>             + (REGISTER_BYTE (regno) - REGISTER_BYTE (FP0_REGNUM)));
> 
>     /* Wide registers come from the ss_wide area.
> ***************
> *** 215,221 ****
>        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
> --- 215,221 ----
>        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
> ***************
> *** 232,240 ****
>         errno = 0;
>         /* Copy an int from the U area to buf.  Fill the least
>            significant end if len != raw_size.  */
> !       * (int *) &buf[offset + i] =
> !         call_ptrace (PT_RUREGS, inferior_pid,
> !                      (PTRACE_ARG3_TYPE) addr + i, 0);
>         if (errno != 0)
>         {
>           /* Warning, not error, in case we are attached; sometimes
> --- 232,240 ----
>         errno = 0;
>         /* Copy an int from the U area to buf.  Fill the least
>            significant end if len != raw_size.  */
> !       *(int *) &buf[offset + i] =
> !       call_ptrace (PT_RUREGS, inferior_pid,
> !                    (PTRACE_ARG3_TYPE) addr + i, 0);
>         if (errno != 0)
>         {
>           /* Warning, not error, in case we are attached; sometimes
> ***************
> *** 277,283 ****
>   {
>     register int i;
>     /* Round starting address down to longword boundary.  */
> !   register CORE_ADDR addr = memaddr & - (CORE_ADDR)(sizeof (int));
>     /* Round ending address up; get number of longwords that makes.  */
>     register int count
>     = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
> --- 277,283 ----
>   {
>     register int i;
>     /* Round starting address down to longword boundary.  */
> !   register CORE_ADDR addr = memaddr & -(CORE_ADDR) (sizeof (int));
>     /* Round ending address up; get number of longwords that makes.  */
>     register int count
>     = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
> ***************
> *** 363,370 ****
>                                    inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
>           if (errno)
>             {
> !             free (buffer);
> !             return 0;
>             }
>           QUIT;
>         }
> --- 363,379 ----
>                                    inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
>           if (errno)
>             {
> !             /* As above, we may have guessed wrong about code vs. data, so
> !                        try it the other way. */
> !             errno = 0;
> !             buffer[i] = call_ptrace (addr >= text_end ?
> !                                      PT_RIUSER : PT_RDUSER,
> !                                      inferior_pid,
> !                                      (PTRACE_ARG3_TYPE) addr, 0);
> !             if (errno) {
> !               free(buffer);
> !               return 0;
> !             }
>             }
>           QUIT;
>         }
> ***************
> *** 697,702 ****
> --- 706,713 ----
>   {
>   #if defined(PT_SET_EVENT_MASK)
>     int pt_status;
> +   int nsigs;
> +   int signum;
>     ptrace_event_t ptrace_events;
> 
>     /* Instruct the kernel as to the set of events we wish to be
> ***************
> *** 709,715 ****
>        the kernel to keep certain signals hidden from us, we do it
>        by calling sigdelset (ptrace_events.pe_signals, signal) for
>        each such signal here, before doing PT_SET_EVENT_MASK.  */
> !   sigemptyset (&ptrace_events.pe_signals);
> 
>     ptrace_events.pe_set_event = 0;
> 
> --- 720,749 ----
>        the kernel to keep certain signals hidden from us, we do it
>        by calling sigdelset (ptrace_events.pe_signals, signal) for
>        each such signal here, before doing PT_SET_EVENT_MASK.  */
> !   /* RM: The above comment is no longer true. We start with ignoring
> !    * all signals, and then add the ones we are interested in. We could
> !    * do it the other way: start by looking at all signals and then
> !    * deleting the ones that we aren't interested in, except that
> !    * multiple gdb signals may be mapped to the same host signal
> !    * (eg. TARGET_SIGNAL_IO and TARGET_SIGNAL_POLL both get mapped to
> !    * signal 22 on HPUX 10.20) We want to be notified if we are
> !    * interested in either signal.
> !    */
> !   sigfillset (&ptrace_events.pe_signals);
> !
> !   /* RM: Let's not bother with signals we don't care about */
> !   nsigs = (int) TARGET_SIGNAL_LAST;
> !   for (signum = nsigs; signum > 0; signum--)
> !     {
> !       if ((signal_stop_state (signum)) ||
> !         (signal_print_state (signum)) ||
> !         (!signal_pass_state (signum)))
> !       {
> !         if (target_signal_exists (signum))
> !           sigdelset (&ptrace_events.pe_signals,
> !                      target_signal_to_host (signum));
> !       }
> !     }
> 
>     ptrace_events.pe_set_event = 0;
> 
> ***************
> *** 724,730 ****
>     errno = 0;
>     pt_status = call_ptrace (PT_SET_EVENT_MASK,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) & ptrace_events,
>                            sizeof (ptrace_events));
>     if (errno)
>       perror_with_name ("ptrace");
> --- 758,764 ----
>     errno = 0;
>     pt_status = call_ptrace (PT_SET_EVENT_MASK,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) &ptrace_events,
>                            sizeof (ptrace_events));
>     if (errno)
>       perror_with_name ("ptrace");
> ***************
> *** 763,769 ****
>     errno = 0;
>     pt_status = call_ptrace (PT_SET_EVENT_MASK,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) & ptrace_events,
>                            sizeof (ptrace_events));
>     if (errno)
>       perror_with_name ("ptrace");
> --- 797,803 ----
>     errno = 0;
>     pt_status = call_ptrace (PT_SET_EVENT_MASK,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) &ptrace_events,
>                            sizeof (ptrace_events));
>     if (errno)
>       perror_with_name ("ptrace");
> ***************
> *** 913,919 ****
>     errno = 0;
>     pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) & ptrace_state,
>                            sizeof (ptrace_state));
>     if (errno)
>       perror_with_name ("ptrace");
> --- 947,953 ----
>     errno = 0;
>     pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) &ptrace_state,
>                            sizeof (ptrace_state));
>     if (errno)
>       perror_with_name ("ptrace");
> ***************
> *** 947,953 ****
>     errno = 0;
>     pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) & ptrace_state,
>                            sizeof (ptrace_state));
>     if (errno)
>       perror_with_name ("ptrace");
> --- 981,987 ----
>     errno = 0;
>     pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) &ptrace_state,
>                            sizeof (ptrace_state));
>     if (errno)
>       perror_with_name ("ptrace");
> ***************
> *** 1008,1013 ****
> --- 1042,1049 ----
>        int pid;
>        char **execd_pathname;
>   {
> +   static char saved_pathname[1024];
> +
>     /* This request is only available on HPUX 10.0 and later.  */
>   #if !defined(PT_GET_PROCESS_STATE)
>     *execd_pathname = NULL;
> ***************
> *** 1020,1026 ****
>     errno = 0;
>     pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) & ptrace_state,
>                            sizeof (ptrace_state));
>     if (errno)
>       perror_with_name ("ptrace");
> --- 1056,1062 ----
>     errno = 0;
>     pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) &ptrace_state,
>                            sizeof (ptrace_state));
>     if (errno)
>       perror_with_name ("ptrace");
> ***************
> *** 1029,1036 ****
> 
>     if (ptrace_state.pe_report_event & PTRACE_EXEC)
>       {
> !       char *exec_file = target_pid_to_exec_file (pid);
> !       *execd_pathname = savestring (exec_file, strlen (exec_file));
>         return 1;
>       }
> 
> --- 1065,1083 ----
> 
>     if (ptrace_state.pe_report_event & PTRACE_EXEC)
>       {
> !       char *exec_file;
> !
> !       if (ptrace_state.pe_path_len > 0)
> !       {
> !         /* RM: ptrace reports 2 exec events per exec. Only the first one
> !            allows us to get a valid pathname. For the second one simply
> !            return the previously cached pathname */
> !         exec_file = target_pid_to_exec_file (pid);
> !         *execd_pathname = savestring (exec_file, strlen (exec_file));
> !         strncpy (saved_pathname, exec_file, sizeof (saved_pathname) - 1);
> !       }
> !       else
> !       *execd_pathname = saved_pathname;
>         return 1;
>       }
> 
> ***************
> *** 1064,1069 ****
> --- 1111,1117 ----
>   {
>     static char exec_file_buffer[1024];
>     int pt_status;
> +   ptrace_state_t ptrace_state;
>     CORE_ADDR top_of_stack;
>     char four_chars[4];
>     int name_index;
> ***************
> *** 1073,1084 ****
> 
>   #ifdef PT_GET_PROCESS_PATHNAME
>     /* As of 10.x HP-UX, there's an explicit request to get the pathname. */
> !   pt_status = call_ptrace (PT_GET_PROCESS_PATHNAME,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) exec_file_buffer,
> !                          sizeof (exec_file_buffer) - 1);
> !   if (pt_status == 0)
> !     return exec_file_buffer;
>   #endif
> 
>     /* It appears that this request is broken prior to 10.30.
> --- 1121,1146 ----
> 
>   #ifdef PT_GET_PROCESS_PATHNAME
>     /* As of 10.x HP-UX, there's an explicit request to get the pathname. */
> !   /* RM: According to the documentation, this request only works right
> !    * after an exec */
> !   errno = 0;
> !   pt_status = call_ptrace (PT_GET_PROCESS_STATE,
>                            pid,
> !                          (PTRACE_ARG3_TYPE) &ptrace_state,
> !                          sizeof (ptrace_state));
> !   if (errno)
> !     perror_with_name ("ptrace");
> !
> !   if (ptrace_state.pe_report_event & PTRACE_EXEC)
> !     {
> !       pt_status = call_ptrace (PT_GET_PROCESS_PATHNAME,
> !                              pid,
> !                              (PTRACE_ARG3_TYPE) exec_file_buffer,
> !                              sizeof (exec_file_buffer) - 1);
> !       /* RM: ??? pt_status < 0 indicates failure, I think */
> !       if (pt_status >= 0)
> !       return exec_file_buffer;
> !     }
>   #endif
> 
>     /* It appears that this request is broken prior to 10.30.
> Index: gdb/target.c
> /opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/target.c gdb/target.c
> *** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/target.c    Fri Nov  5 17:36:01 1999
> --- gdb/target.c        Fri Nov  5 17:37:12 1999
> ***************
> *** 1915,1920 ****
> --- 1915,2066 ----
>       }
>   }
> 
> + int
> + target_signal_exists (oursig)
> +      enum target_signal oursig;
> + {
> +   switch (oursig)
> +     {
> +     case TARGET_SIGNAL_0:
> + #if defined (SIGHUP)
> +     case TARGET_SIGNAL_HUP:
> + #endif
> + #if defined (SIGINT)
> +     case TARGET_SIGNAL_INT:
> + #endif
> + #if defined (SIGQUIT)
> +     case TARGET_SIGNAL_QUIT:
> + #endif
> + #if defined (SIGILL)
> +     case TARGET_SIGNAL_ILL:
> + #endif
> + #if defined (SIGTRAP)
> +     case TARGET_SIGNAL_TRAP:
> + #endif
> + #if defined (SIGABRT)
> +     case TARGET_SIGNAL_ABRT:
> + #endif
> + #if defined (SIGEMT)
> +     case TARGET_SIGNAL_EMT:
> + #endif
> + #if defined (SIGFPE)
> +     case TARGET_SIGNAL_FPE:
> + #endif
> + #if defined (SIGKILL)
> +     case TARGET_SIGNAL_KILL:
> + #endif
> + #if defined (SIGBUS)
> +     case TARGET_SIGNAL_BUS:
> + #endif
> + #if defined (SIGSEGV)
> +     case TARGET_SIGNAL_SEGV:
> + #endif
> + #if defined (SIGSYS)
> +     case TARGET_SIGNAL_SYS:
> + #endif
> + #if defined (SIGPIPE)
> +     case TARGET_SIGNAL_PIPE:
> + #endif
> + #if defined (SIGALRM)
> +     case TARGET_SIGNAL_ALRM:
> + #endif
> + #if defined (SIGTERM)
> +     case TARGET_SIGNAL_TERM:
> + #endif
> + #if defined (SIGUSR1)
> +     case TARGET_SIGNAL_USR1:
> + #endif
> + #if defined (SIGUSR2)
> +     case TARGET_SIGNAL_USR2:
> + #endif
> + #if defined (SIGCHLD) || defined (SIGCLD)
> +     case TARGET_SIGNAL_CHLD:
> + #endif /* SIGCLD or SIGCHLD */
> + #if defined (SIGPWR)
> +     case TARGET_SIGNAL_PWR:
> + #endif
> + #if defined (SIGWINCH)
> +     case TARGET_SIGNAL_WINCH:
> + #endif
> + #if defined (SIGURG)
> +     case TARGET_SIGNAL_URG:
> + #endif
> + #if defined (SIGIO)
> +     case TARGET_SIGNAL_IO:
> + #endif
> + #if defined (SIGPOLL)
> +     case TARGET_SIGNAL_POLL:
> + #endif
> + #if defined (SIGSTOP)
> +     case TARGET_SIGNAL_STOP:
> + #endif
> + #if defined (SIGTSTP)
> +     case TARGET_SIGNAL_TSTP:
> + #endif
> + #if defined (SIGCONT)
> +     case TARGET_SIGNAL_CONT:
> + #endif
> + #if defined (SIGTTIN)
> +     case TARGET_SIGNAL_TTIN:
> + #endif
> + #if defined (SIGTTOU)
> +     case TARGET_SIGNAL_TTOU:
> + #endif
> + #if defined (SIGVTALRM)
> +     case TARGET_SIGNAL_VTALRM:
> + #endif
> + #if defined (SIGPROF)
> +     case TARGET_SIGNAL_PROF:
> + #endif
> + #if defined (SIGXCPU)
> +     case TARGET_SIGNAL_XCPU:
> + #endif
> + #if defined (SIGXFSZ)
> +     case TARGET_SIGNAL_XFSZ:
> + #endif
> + #if defined (SIGWIND)
> +     case TARGET_SIGNAL_WIND:
> + #endif
> + #if defined (SIGPHONE)
> +     case TARGET_SIGNAL_PHONE:
> + #endif
> + #if defined (SIGLOST)
> +     case TARGET_SIGNAL_LOST:
> + #endif
> + #if defined (SIGWAITING)
> +     case TARGET_SIGNAL_WAITING:
> + #endif
> + #if defined (SIGLWP)
> +     case TARGET_SIGNAL_LWP:
> + #endif
> + #if defined (SIGDANGER)
> +     case TARGET_SIGNAL_DANGER:
> + #endif
> + #if defined (SIGGRANT)
> +     case TARGET_SIGNAL_GRANT:
> + #endif
> + #if defined (SIGRETRACT)
> +     case TARGET_SIGNAL_RETRACT:
> + #endif
> + #if defined (SIGMSG)
> +     case TARGET_SIGNAL_MSG:
> + #endif
> + #if defined (SIGSOUND)
> +     case TARGET_SIGNAL_SOUND:
> + #endif
> + #if defined (SIGSAK)
> +     case TARGET_SIGNAL_SAK:
> + #endif
> + #if defined (SIGPRIO)
> +     case TARGET_SIGNAL_PRIO:
> + #endif
> +       return 1;
> +
> +     default:
> +       return 0;
> +     }
> + }
> +
>   /* Helper function for child_wait and the Lynx derivatives of child_wait.
>      HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
>      translation of that in OURSTATUS.  */
> Index: gdb/target.h
> /opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/target.h gdb/target.h
> *** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/target.h    Fri Nov  5 17:37:37 1999
> --- gdb/target.h        Fri Nov  5 17:38:12 1999
> ***************
> *** 1327,1332 ****
> --- 1327,1333 ----
>   /* Convert between host signal numbers and enum target_signal's.  */
>   extern enum target_signal target_signal_from_host PARAMS ((int));
>   extern int target_signal_to_host PARAMS ((enum target_signal));
> + extern int target_signal_exists PARAMS ((enum target_signal));
> 
>   /* Convert from a number used in a GDB command to an enum target_signal.  */
>   extern enum target_signal target_signal_from_command PARAMS ((int));
> Index: gdb/infrun.c
> /opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/infrun.c gdb/infrun.c
> *** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/infrun.c    Fri Nov  5 18:37:38 1999
> --- gdb/infrun.c        Fri Nov  5 18:38:41 1999
> ***************
> *** 3621,3626 ****
> --- 3621,3633 ----
>         }
>       }
> 
> +
> + #ifdef GDB_TARGET_IS_HPPA
> +   /* RM: Use OS interface to ignore signals we don't care about */
> +   if (target_has_execution)
> +     require_notification_of_events (inferior_pid);
> + #endif
> +
>     do_cleanups (old_chain);
>   }
>
From ac131313@cygnus.com Thu Nov 11 16:07:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Stan Shebs <shebs@cygnus.com>
Cc: cagney@cygnus.com, gdb-patches@sourceware.cygnus.com, guo@cup.hp.com
Subject: Re: (patch) hpjyg21: FAT_FREE_PSYMTABS
Date: Thu, 11 Nov 1999 16:07:00 -0000
Message-id: <382B5A0D.31585A7A@cygnus.com>
References: <199911112341.PAA29252@andros.cygnus.com>
X-SW-Source: 1999-q4/msg00241.html
Content-length: 967

Stan Shebs wrote:
> 
>    Date: Fri, 12 Nov 1999 10:10:14 +1100
>    From: Andrew Cagney <ac131313@cygnus.com>
> 
>    I've another meta maintainer question on this :-)
> 
>    Is it better to use #ifdef or have the compiler eliminate optional
>    code?  For instance:
> 
>            if (FAT_FREE_PSYMTABS)
>              {
>              }
> 
> I favor this over ifdefs.  Not only does it facilitate maintenance,
> but it leaves open options for cross-debugging and for making
> decisions at runtime.  The only reasonable exception would be provably
> time-critical code where ifdefs would allow compiler optimizations not
> available if the code were merely "if (0)".  (There might be examples
> of this in the stabs reader, although I don't know of any myself.)

``Trust me'', there are no cases where this can occure :-)

Compiling with -O eliminates all of them (well it does for GCC, if other
compilers can't eliminate that then they are broken :-).

	Andrew
From guo@cup.hp.com Thu Nov 11 16:31:00 1999
From: Jimmy Guo <guo@cup.hp.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15: hppah-nat.c & related
Date: Thu, 11 Nov 1999 16:31:00 -0000
Message-id: <Pine.LNX.4.10.9911111610120.6426-100000@hpcll168.cup.hp.com>
References: <382B585D.421E98F3@cygnus.com>
X-SW-Source: 1999-q4/msg00242.html
Content-length: 1348

>Don't forget that the GDB's coding style is defined by the output of
>indent.  Looking more closely I noticed that some of the changes are to
>``fix'' the indentation. Please just grit your teath and ignore it.
>
>It's a good idea to carefully review the diffs and revert/remove any
>changes not specific to the problem at hand.
>
>Doing this makes the reviewers life so much easier.

Andrew,

I'm aware of this problem and I'm trying to resolve this.  Interestly,
yes I'm reversing what indent did, _not_ to create noises, but to remove
them.  If you run indent on, say hppah-nat.c, straight from the 19991108
snapshot, you will see that it's not in GDB's coding style (since indent
is not happy with the way the code is!)

I _ran_ indent on source files before I make a patch (ok, in some cases
I might forgot to do so which might have turned out to be a good thing)
... and that's how most diff noises are introduced.  I came to realize
this and am starting to do the reserve -- change back what indent changed
that's not relevant to the patch, to make the changes in my patches
conform to GDB's coding style.  Given how much indent changes a source
file, it could be very time consuming and 'non-productive', but I'm
doing my share to help the situation.

BTW, I'm using indent 1.9.1 on Linux, with no arguments.

- Jimmy Guo, guo@cup.hp.com


      reply	other threads:[~1999-11-11 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-11 12:53 Jimmy Guo
1999-11-11 15:10 ` Andrew Cagney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=382B4CD6.4B13DFA1@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=guo@cup.hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox