public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/26948] New: [-m32] ERROR: ld.so: object 'slow-waitpid.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored
@ 2020-11-26  8:56 vries at gcc dot gnu.org
  2020-11-26  8:57 ` [Bug testsuite/26948] " vries at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-26  8:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26948

            Bug ID: 26948
           Summary: [-m32] ERROR: ld.so: object 'slow-waitpid.so' from
                    LD_PRELOAD cannot be preloaded (wrong ELF class:
                    ELFCLASS32): ignored
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When running test-case gdb.threads/attach-slow-waitpid.exp with an x86_64 -m64
gdb, and target board unix/-m32, we run into:
...
spawn /home/vries/gdb_versions/devel/build/gdb/testsuite/../../gdb/gdb -nw -nx
-data-directory
/home/vries/gdb_versions/devel/build/gdb/testsuite/../data-directory -iex set
height 0 -iex set width 0^M
ERROR: ld.so: object
'/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.threads/attach-slow-waitpid/slow-waitpid.so'
from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.^M
...

So, we make a shared lib slow-waitpid.so that we want to preload for gdb to
modify its behaviour.

However, our means of generating the shared library is limited by the target
board unix/-m32 setting, which forces it to be 32-bit.

Consequently gdb and the shared lib are incompatible, and the preloading fails,
and we're not testing the behaviour that we want to test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug testsuite/26948] [-m32] ERROR: ld.so: object 'slow-waitpid.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored
  2020-11-26  8:56 [Bug testsuite/26948] New: [-m32] ERROR: ld.so: object 'slow-waitpid.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored vries at gcc dot gnu.org
@ 2020-11-26  8:57 ` vries at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-26  8:57 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26948

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f2954fd5192..25ce5b4cbcb 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2020,10 +2020,24 @@ proc default_gdb_start { } {
        set inferior_spawn_id $gdb_spawn_id
     }

+    # When running the testsuite with:
+    # - an x86_64 -m64 gdb, and
+    # - target board unix/-m32
+    # we may run into:
+    # ERROR: ld.so: object 'foo.so' from LD_PRELOAD cannot be preloaded \
+    #   (wrong ELF class: ELFCLASS32): ignored.
+    set preload_failed_re \
+       "ERROR: ld.so: object .* from LD_PRELOAD cannot be preloaded"
+
     # When running over NFS, particularly if running many simultaneous
     # tests on different hosts all using the same server, things can
     # get really slow.  Give gdb at least 3 minutes to start up.
     gdb_expect 360 {
+       -re "$preload_failed_re.*\[\r\n\]$gdb_prompt $" {
+           verbose "GDB initialized, but failed to preload, exiting"
+           gdb_exit
+           return -1
+       }
        -re "\[\r\n\]$gdb_prompt $" {
            verbose "GDB initialized."
        }
...

With which we get:
...
PASS: gdb.threads/attach-slow-waitpid.exp: compile preload library:
successfully compiled posix threads test case
PASS: gdb.threads/attach-slow-waitpid.exp: compile test executable:
successfully compiled posix threads test case
UNTESTED: gdb.threads/attach-slow-waitpid.exp: Couldn't start GDB with
preloaded lib
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-26  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  8:56 [Bug testsuite/26948] New: [-m32] ERROR: ld.so: object 'slow-waitpid.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored vries at gcc dot gnu.org
2020-11-26  8:57 ` [Bug testsuite/26948] " vries at gcc dot gnu.org

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).