This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

Re: [RFA] info sharedlibrary fix


Kevin Buettner wrote:
> 
> On Jan 7, 11:55am, Michael Snyder wrote:
> 
> > There are two changes here, but they're related.
> >
> > 1) Use TARGET_PTR_BIT instead of bfd_get_arch_size to distinguish
> > 32 bit vs. 64 bit inferior.  This was introduced primarily to tell the
> > difference between a 32 bit process and a 64 bit process on Sparc64
> > Solaris.
> >
> > 2) Since we really don't have to have an exec_bfd, don't bail out
> > just because there isn't one.  This allows the command (info shared)
> > to work when we attach to an anonymous process.
> >
> >
> > 2002-01-07  Michael Snyder  <msnyder@redhat.com>
> >
> >       * solib.c (info_sharedlibrary_command): Use TARGET_PTR_BIT
> >       instead of bfd_get_arch_size.  Don't bail out just because
> >       there's no exec_bfd.
> 
> Seems okay to me.  (Approved.)
> 
> Now that we're using TARGET_PTR_BIT, I wonder if we still need
> the following test:
> 
> >     /* Default to 32-bit in case of failure.  */
> >     if (arch_size == 32 || arch_size == -1)

You're right, I'll remove it.  In which case, we really don't need
the variable anymore.

Committed, in the following form:




2002-01-07  Michael Snyder  <msnyder@redhat.com>

        * solib.c (info_sharedlibrary_command): Use TARGET_PTR_BIT
        instead of bfd_get_arch_size.  Don't bail out just because
        there's no exec_bfd.

Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.46
diff -c -3 -p -r1.46 solib.c
*** solib.c     2001/12/04 09:34:56     1.46
--- solib.c     2002/01/08 18:23:19
*************** info_sharedlibrary_command (char *ignore
*** 618,642 ****
    int header_done = 0;
    int addr_width;
    char *addr_fmt;
-   int arch_size;
  
!   if (exec_bfd == NULL)
      {
-       printf_unfiltered ("No executable file.\n");
-       return;
-     }
- 
-   arch_size = bfd_get_arch_size (exec_bfd);
-   if (arch_size == -1)
-     arch_size = bfd_arch_bits_per_address(exec_bfd);
- 
-   /* Default to 32-bit in case of failure.  */
-   if (arch_size == 32 || arch_size == -1)
-     {
        addr_width = 8 + 4;
        addr_fmt = "08l";
      }
!   else if (arch_size == 64)
      {
        addr_width = 16 + 4;
        addr_fmt = "016l";
--- 618,630 ----
    int header_done = 0;
    int addr_width;
    char *addr_fmt;
  
!   if (TARGET_PTR_BIT == 32)
      {
        addr_width = 8 + 4;
        addr_fmt = "08l";
      }
!   else if (TARGET_PTR_BIT == 64)
      {
        addr_width = 16 + 4;
        addr_fmt = "016l";
*************** info_sharedlibrary_command (char *ignore
*** 644,651 ****
    else
      {
        internal_error (__FILE__, __LINE__,
!                     "bfd_get_arch_size() returned unknown size %d",
!                     arch_size);
      }
  
    update_solib_list (from_tty, 0);
--- 632,639 ----
    else
      {
        internal_error (__FILE__, __LINE__,
!                     "TARGET_PTR_BIT returned unknown size %d",
!                     TARGET_PTR_BIT);
      }
  
    update_solib_list (from_tty, 0);


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