From: Carl Love <cel@linux.ibm.com>
To: gdb-patches@sourceware.org, Carl Love <cel@linux.ibm.com>
Subject: Help with break in printf function
Date: Fri, 26 Jan 2024 14:37:05 -0800 [thread overview]
Message-ID: <4c92aa19-ca28-44e4-97c6-3b0b4d9da512@linux.ibm.com> (raw)
GDB developers:
I have a few tests that fail on PowerPC that I could use some help to fix in gdb. The issue is you set a breakpoint in the printf function but gdb does not find/stop at the breakpoint. I think it might have something to do with the fact that the system has support for IEEE 128-bit floating point numbers.
Initially I set a breakpoint in in printf and main for the test program
gdb/testsuite/gdb.base/annota1.c.
(gdb) break printf
Function "printf" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (printf) pending.
gdb) break main
Breakpoint 2 at 0x10000788: file /.../binutils-gdb-printf/gdb/testsuite/gdb.base/annota1.c, line 15.
Then run to main
(gdb) r
Starting program: /home/carll/GDB/build-printf/gdb/testsuite/outputs/gdb.base/annota1/annota1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 2, main ())
at /.../binutils-gdb-printf/gdb/testsuite/gdb.base/annota1.c:15
I then single step to the print statement in main.
gdb) s
23 printf ("value is %d\n", value);
(gdb) s
Downloading source file /usr/src/debug/glibc-2.37-16.fc38.ppc64le/stdio-common/../sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
___ieee128_printf (format=0x100008f0 "value is %d\n")
at ../sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c:29
29 done = __vfprintf_internal (stdout, format, ap,
I can see that it stepped into an ieee128-printf.c file. But when I print out the location of the breakpoints
(gdb) maint info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00007ffff7a6f8b8 in __printf at printf.c:28 inf 1
1.1 y 0x00007ffff7a6f8b8 in __printf at printf.c:28 inf 1
2 breakpoint keep y 0x0000000010000788 in main
at /.../gdb/testsuite/gdb.base/annota1.c:15 inf 1
I see the breakpoint is set in a different file printf.c.
So, it would seem that GDB doesn't know that the test is compiled to use the print routine in ieee128-printf.c?
I am guessing the issue has to do with gdb reading the binary to determine what files/functions the program uses. Not sure where/how GDB parses the binary to figure out where the library functions are located. I am guessing gdb is not getting the correct function/file information from the binary. If anyone has any ideas on how to go about debugging/fixing the issue, the help would be greatly appreciated. Thanks.
Carl
next reply other threads:[~2024-01-26 22:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 22:37 Carl Love [this message]
2024-01-27 9:24 ` Andreas Schwab
2024-01-29 16:41 ` Carl Love
2024-01-29 18:50 ` Tom Tromey
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=4c92aa19-ca28-44e4-97c6-3b0b4d9da512@linux.ibm.com \
--to=cel@linux.ibm.com \
--cc=gdb-patches@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).