This is the mail archive of the 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: set sysroot command on AIX has no effect.

Hi Ulrich,

Thanks for the review and comments.

If we call solib_bfd_open for .a files then the call to open file using 
gdb_open_cloexec inside solib_find function is failing.
The reason for this is,
we will be getting library information from ld_info in the form of 
"/usr/lib/libc.a(shr.o)", but actually we will be having the
file in filesystem as /usr/lib/libc.a. This is the reason initially i 
didn't use solib_bfd_open.

But i experimented some more and tried to see how gdb behaves if we pass 
modified pathname exactly as the file which we are having in the machine, 
like "/usr/lib/libc.a".
Then bfd bfd_check_format is failing with the error "not in executable 
Looks like bfd isn't able to recognise the .a archives.
I can have a look on why bfd check is failing.
Please let me know if this is the right way to move forward or you have 
any suggestions.


From:   "Ulrich Weigand" <>
To:     Sangamesh Mallayya/India/IBM@IBMIN
Date:   09/29/2016 08:52 PM
Subject:        Re: set sysroot command on AIX has no effect.

Sangamesh Mallaya wrote:

> set sysroot command on AIX has no effect if a program depends on shared
> library archives (.a).

Yes, that seems a bug.

> +  /* If gdb_sysroot is set via set sysroot command, 
> +     then we need to prefix gdb_sysroot to shared library path  */
> +  /* .a shared library archives case */
> +  if (gdb_sysroot != NULL && *gdb_sysroot != 0) {
> +      sys_path = alloca (sizeof(gdb_sysroot)+strlen(pathname)); 
> +      memset (sys_path, 0, sizeof(sys_path));
> +      strcpy(sys_path, gdb_sysroot);
> +      pathname = strcat (sys_path, pathname);
> +  }
> +  path_len = strlen (pathname);

This duplicates some of the logic in solib_find.  It would be better
to avoid that duplication ...

Is there any reason why you cannot use solib_find / solib_bfd_fopen
to open the archive file, like solib_bfd_open does?  This would ensure
we're always using the same search logic for .a files as for .so files.


  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain

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