From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5FE5D384404D; Thu, 2 Jul 2020 13:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FE5D384404D From: "david.spickett at linaro dot org" To: gdb-prs@sourceware.org Subject: [Bug gdb/26196] New: gdb error message is unclear when attempting to load a file >2GB via gdbserver Date: Thu, 02 Jul 2020 13:37:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.spickett at linaro dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2020 13:37:59 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26196 Bug ID: 26196 Summary: gdb error message is unclear when attempting to load a file >2GB via gdbserver Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: david.spickett at linaro dot org Target Milestone: --- This is related to https://sourceware.org/bugzilla/show_bug.cgi?id=3D23198,= filed as a new ticket for the gdb error message specifically. I attempted to debug lldb by attaching gdbserver to it then connecting to t= hat with gdb. lldb references a shared library that contains its commands. This library is >2GB in size when built in debug mode. The error message gdb gives me when trying to load this is: Reading /work/open_source/lldb-cross-compile/build-host-debug/bin/../lib/liblldb.so= .11git from remote target... Error while mapping shared library sections: `target:/work/open_source/lldb-cross-compile/build-host-debug/bin/../lib/li= blldb.so.11git': not in executable format: file format not recognized (gdb) info shared >>From To Syms Read Shared Object Library <...> No=20=20=20=20=20=20=20=20=20 /work/open_source/lldb-cross-compile/build-host-debug/bin/../lib/liblldb.so= .11git We can see from logging in gdbserver that the failure is because the offset sent to pread is invalid when trying to get the first section header. require_int in gdbserver is checking that the offset is not > 0x80000000. getpkt ("vFile:pread:a,3fff,9ab473c8"); [no ack sent] putpkt ("$F-1,16#37"); [noack mode] // 0x16 aka FILEIO_EINVAL (https://sourceware.org/gdb/current/onlinedocs/gdb/Host-I_002fO-Packets.htm= l) The error message implies that the format is incorrect (although it earlier read the ELF bytes) and I initially thought that gdbserver had read the sym= link as a real file (liblldb.so.11git links to the real .so). Which I'm not sure= is even possible but I tried to narrow it down from there. I think this error message should say something like ": file offset o= f X is beyond limit of vFile:pread packet". (or bail a lot earlier once we see = that the size is >2GB) The root issue would be the vFile packet itself but this is a niche use case and you can workaround it by setting a sysroot to load the file from the lo= cal machine. An improved error would make it clearer what you need to do. --=20 You are receiving this mail because: You are on the CC list for the bug.=