public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31730] New: backtrace_symbols_fd prints different strings than backtrace_symbols returns
@ 2024-05-12 13:50 bruno at clisp dot org
2024-05-12 13:50 ` [Bug libc/31730] " bruno at clisp dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2024-05-12 13:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31730
Bug ID: 31730
Summary: backtrace_symbols_fd prints different strings than
backtrace_symbols returns
Product: glibc
Version: 2.39
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: bruno at clisp dot org
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 15516
--> https://sourceware.org/bugzilla/attachment.cgi?id=15516&action=edit
test case foo.c
The documentation of backtrace_symbols_fd in
https://www.gnu.org/software/libc/manual/html_node/Backtraces.html says: "The
backtrace_symbols_fd function performs the same translation as the function
backtrace_symbols function. Instead of returning the strings to the caller, it
writes the strings to the file descriptor fd, one per line."
But in glibc 2.39, it prints different strings.
How to reproduce:
============================= foo.c =============================
#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
static void
test_backtrace (void)
{
void *buffer[10];
int size;
char **symbols;
size = backtrace (buffer, 10);
backtrace_symbols_fd (buffer, size, 1);
printf ("\n");
symbols = backtrace_symbols (buffer, size);
if (symbols != NULL)
{
for (int i = 0; i < size; ++i)
printf ("%s\n", symbols[i]);
free (symbols);
}
}
int
main (void)
{
test_backtrace ();
}
================================================================
$ gcc -Wall foo.c
$ ./a.out
./a.out[0x40118f]
./a.out[0x40121a]
/lib64/libc.so.6(+0x2a088)[0x7fc7bf945088]
/lib64/libc.so.6(__libc_start_main+0x8b)[0x7fc7bf94514b]
./a.out[0x4010b5]
./a.out() [0x40118f]
./a.out() [0x40121a]
/lib64/libc.so.6(+0x2a088) [0x7fc7bf945088]
/lib64/libc.so.6(__libc_start_main+0x8b) [0x7fc7bf94514b]
./a.out() [0x4010b5]
As you can see, the strings printed by backtrace_symbols_fd lack
1. a substring "()" when the offset is not known,
2. a space before the '[' character.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/31730] backtrace_symbols_fd prints different strings than backtrace_symbols returns
2024-05-12 13:50 [Bug libc/31730] New: backtrace_symbols_fd prints different strings than backtrace_symbols returns bruno at clisp dot org
@ 2024-05-12 13:50 ` bruno at clisp dot org
2024-05-14 10:57 ` schwab@linux-m68k.org
2024-05-14 11:27 ` bruno at clisp dot org
2 siblings, 0 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2024-05-12 13:50 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31730
Bruno Haible <bruno at clisp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Host| |x86_64-redhat-linux
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/31730] backtrace_symbols_fd prints different strings than backtrace_symbols returns
2024-05-12 13:50 [Bug libc/31730] New: backtrace_symbols_fd prints different strings than backtrace_symbols returns bruno at clisp dot org
2024-05-12 13:50 ` [Bug libc/31730] " bruno at clisp dot org
@ 2024-05-14 10:57 ` schwab@linux-m68k.org
2024-05-14 11:27 ` bruno at clisp dot org
2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2024-05-14 10:57 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31730
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |2.40
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Fixed with commit ec6ed525f1.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/31730] backtrace_symbols_fd prints different strings than backtrace_symbols returns
2024-05-12 13:50 [Bug libc/31730] New: backtrace_symbols_fd prints different strings than backtrace_symbols returns bruno at clisp dot org
2024-05-12 13:50 ` [Bug libc/31730] " bruno at clisp dot org
2024-05-14 10:57 ` schwab@linux-m68k.org
@ 2024-05-14 11:27 ` bruno at clisp dot org
2 siblings, 0 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2024-05-14 11:27 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31730
--- Comment #2 from Bruno Haible <bruno at clisp dot org> ---
Thank you!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-14 11:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-12 13:50 [Bug libc/31730] New: backtrace_symbols_fd prints different strings than backtrace_symbols returns bruno at clisp dot org
2024-05-12 13:50 ` [Bug libc/31730] " bruno at clisp dot org
2024-05-14 10:57 ` schwab@linux-m68k.org
2024-05-14 11:27 ` bruno at clisp dot 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).