public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "Daniel.Lehne@amk-drives.bg" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/13989] New: gdb invalid search order for shared libraries by cross debuging
Date: Wed, 18 Apr 2012 11:30:00 -0000	[thread overview]
Message-ID: <bug-13989-4717@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=13989

             Bug #: 13989
           Summary: gdb invalid search order for shared libraries by cross
                    debuging
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: Daniel.Lehne@amk-drives.bg
    Classification: Unclassified


Hello,

i think the order to search libraries:

1st sysroot
2nd host-sysroot (absolute path of lib on host)
3rd solib-search-path 

for cross debugging is not usable. In this case libraries of the host-sysroot
replace the libraries for cross target in solib-search-path, and debugging
becomes impossible.
I configured GDB with --with-sysroot, declared additional set sysroot, set
solib-search-path, set solib-absolute-path (nevermind alias of set sysroot). 

Example:
Simple Hello world project, additional lib freetype and jpeg (they should
exists host-sysroot), linked to binary. Gdb session started with init:
set sysroot <TOOLCHAIN>
set solib-search-path <SPECIAL LIBS>

#include "stdio.h"

int main(int argc, char **argv) {
    printf("test");
}

Invoking: Cross GCC Compiler
arm-1136jfs-linux-gnueabi-gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP
-MF"main.d" -MT"main.d" -o "main.o" "../main.c"
../main.c: In function 'main':
../main.c:5:1: warning: control reaches end of non-void function
Finished building: ../main.c

Building target: gdb_bug_sysroot
Invoking: Cross GCC Linker
arm-1136jfs-linux-gnueabi-gcc -L/home/opt/amklibs/arm-1136jfs -o
"gdb_bug_sysroot"  ./main.o   -lz -ljpeg -lfreetype
Finished building target: gdb_bug_sysroot

GDB-Session:

...
252,189
=library-loaded,id="/usr/lib/libz.so.1",target-name="/usr/lib/libz.so.1",host-name="/home/opt/libs/arm-1136jfs/libz.so.1",symbols-loaded="0",thread-group="i1"
252,190 &"warning: `/usr/lib/libjpeg.so.8': Shared library architecture unknown
is not compatible with target architecture arm.\n"
252,190
=library-loaded,id="/usr/lib/libjpeg.so.8",target-name="/usr/lib/libjpeg.so.8",host-name="/usr/lib/libjpeg.so.8",symbols-loaded="0",thread-group="i1"
252,190
=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-name="/home/opt/Toolchain/arm-1136jfs-linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/sysroot-arm-1136jfs-linux-gnueabi/lib/libc.so.6",symbols-loaded="0",thread-group="i1"
252,190 &"warning: `/lib/libgcc_s.so.1': Shared library architecture unknown is
not compatible with target architecture arm.\n"
252,190
=library-loaded,id="/lib/libgcc_s.so.1",target-name="/lib/libgcc_s.so.1",host-name="/lib/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
...

The library libz loaded correctly from solib-search-path. The library libc.so.6
loaded correctly from Toolchain by sysroot. 

The libjpeg and libfreetype (cut out of log) loaded incorrectly from host
rootfs instead of solib-search-path.

Thanks for a request.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2012-04-18 11:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 11:30 Daniel.Lehne@amk-drives.bg [this message]
2012-04-18 11:50 ` [Bug gdb/13989] " palves at redhat dot com
2012-04-18 12:33 ` Daniel.Lehne@amk-drives.bg
2012-04-18 12:58 ` Daniel.Lehne@amk-drives.bg
2012-05-10 14:31 ` palves at redhat dot com
2012-09-28 19:50 ` palves at redhat dot com
2012-09-28 20:20 ` cvs-commit at gcc dot gnu.org
2012-09-28 21:10 ` palves at redhat dot com

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=bug-13989-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).