From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 796703858401; Wed, 6 Mar 2024 22:25:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 796703858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709763942; bh=0atPpEIoUN0wRZR8sWIdkQPCJCcfTSgNRNKMmNa4VAY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SnqwktpSNfVCFOGIpeqsYs3YKJ9VeyFoKdp3NqEdoBFXexYeWy2CQm/mW02+eWK4e BwnI9k8+EDJKk8U9S0LUx7B9xb1vbUFUko8xckrQW4fd9b8OHfOjmGVMSxZ3fd4/U8 4WX3TiiI3whAY7ZIrbmlIEb9BZNUONP0EfEK0dIQ= From: "cel at linux dot ibm.com" To: gdb-prs@sourceware.org Subject: [Bug gdb/29989] PowerPC, gdb fails to stop at printf call Date: Wed, 06 Mar 2024 22:25:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 12.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cel at linux dot ibm.com 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: Message-ID: In-Reply-To: References: 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29989 --- Comment #4 from Carl E Love --- Digging into the issue further, the issue is not limited to the printf func= tion but all of the symbols for the IEEE 128-bit floating point functions that a= re redirected in glibc.=20=20 PowerPC supports the IBM 128-bit floating point format and the IEEE 128-bit floating point format. The IEEE 128 bit support redirects the various func= tion calls to the ieee128 versions of the functions. For example, the printf function gets linked to the __printfieee128 function at linking time. Gdb= is not aware of the =E2=80=8B__printfieee128 symbol was redirected from the or= iginal printf symbol so it only sets a breakpoint in the standard printf function.= =20 GDB fails to break in the redirected printf function. The printf function = is just one of about 200 IEEE128 bit functions that get remapped for PowerPC. Ulrich and I have looked at fixing this in gdb by creating hidden symbols f= or printf that points to the __printfieee128 function. Although it is possibl= e to do, in general it is really messy/hard to do because because of the naming scheme that was used. The original function was mapped to an ieee128 bit function with one of the following mappings: foo -> __fooieee128 fool -> __fooieee128 foo -> __newnameieee128 foo_r -> __fooieee128_r In GDB, you have to do the reverse mapping from to determine what the origi= nal function name "foo" so you can create a hidden symbol for "foo" that points= to the IEEE 128 bit symbol "__fooiiieee128". We have tried to come up with a simple reverse mapping algorithm, but since __fooieee128 can map back to ei= ther foo or fool you have to search the entire list of mappings to determine what the original name was. Note, there are also some existing symbol names with ieee128 in them that are not the result of redirecting function foo to its = IEEE 128 equivalent function. These also cannot be eliminated without going thru the list of known symbol names that have been redirected.=20=20 A proof of concept patch in gdb which takes the symbol and searches the lis= t of 200+ redirected function names to determine the original symbol name was do= ne and works. The issue is maintaining the list of 200+ function mappings in = gdb is fragile and not considered an acceptable solution. The feeling is the right thing to do is to have glibc emit a local symbol in the library binary, i.e. printf that points to the redirected symbol, i.e. __printfieee128. When the user types "break printf" GDB will set a breakpo= int in the original printf function and in the __printfieee128 function via the local printf symbol in the glibc library.=20=20 Basically, have glibc create the hidden symbol for each of the 200 or so redirected functions rather than having gdb create the hidden symbol as was done in the proof of concept patch. The advantage of having glibc add the local symbol to the library binary is it already knows what symbols are bei= ng redirected and gdb doesn't have to maintain a list of mappings.=20=20 The new redirected symbols need to be dynamic symbols in case only the stri= pped binary is available. --=20 You are receiving this mail because: You are on the CC list for the bug.=