* [Bug tools/23173] New: eu-addr2line does not flush its output, causing problems when used from a script
@ 2018-05-12 17:30 luke at diamand dot org
2018-05-12 19:39 ` [Bug tools/23173] " mark at klomp dot org
2018-05-12 21:18 ` luke at diamand dot org
0 siblings, 2 replies; 3+ messages in thread
From: luke at diamand dot org @ 2018-05-12 17:30 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=23173
Bug ID: 23173
Summary: eu-addr2line does not flush its output, causing
problems when used from a script
Product: elfutils
Version: unspecified
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: tools
Assignee: unassigned at sourceware dot org
Reporter: luke at diamand dot org
CC: elfutils-devel at sourceware dot org
Target Milestone: ---
I noticed that eu-addr2line just write its output to stdout without any
flushing.
That means that if you are using it in a pipe (in my case from Python) feeding
addresses to stdin one at a time, you won't get any output for quite some time.
Just adding a call to fflush(stdout) fixes the problem.
I noticed that the binutils addr2line utility does exactly this:
/* fflush() is essential for using this command as a server
child process that reads addresses from a pipe and responds
with line number information, processing one address at a
time. */
fflush (stdout);
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tools/23173] eu-addr2line does not flush its output, causing problems when used from a script
2018-05-12 17:30 [Bug tools/23173] New: eu-addr2line does not flush its output, causing problems when used from a script luke at diamand dot org
@ 2018-05-12 19:39 ` mark at klomp dot org
2018-05-12 21:18 ` luke at diamand dot org
1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2018-05-12 19:39 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=23173
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org
Assignee|unassigned at sourceware dot org |mark at klomp dot org
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 11013
--> https://sourceware.org/bugzilla/attachment.cgi?id=11013&action=edit
addr2line: Add explicit fflush for stdout when reading from stdin.
That sounds like a good idea. This patch does just that.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tools/23173] eu-addr2line does not flush its output, causing problems when used from a script
2018-05-12 17:30 [Bug tools/23173] New: eu-addr2line does not flush its output, causing problems when used from a script luke at diamand dot org
2018-05-12 19:39 ` [Bug tools/23173] " mark at klomp dot org
@ 2018-05-12 21:18 ` luke at diamand dot org
1 sibling, 0 replies; 3+ messages in thread
From: luke at diamand dot org @ 2018-05-12 21:18 UTC (permalink / raw)
To: elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=23173
Luke Diamand <luke at diamand dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Luke Diamand <luke at diamand dot org> ---
That works like a charm with my Python test code:
#!/usr/bin/python3
import subprocess
import os
addr = b'0xa6308\n'
elf = 'myfile.elf'
a2l='eu-addr2line'
p = subprocess.Popen([a2l, '-f', '--demangle', '-e', elf],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
p.stdin.write(addr)
p.stdin.flush()
print(p.stdout.readline())
print(p.stdout.readline())
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-12 21:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-12 17:30 [Bug tools/23173] New: eu-addr2line does not flush its output, causing problems when used from a script luke at diamand dot org
2018-05-12 19:39 ` [Bug tools/23173] " mark at klomp dot org
2018-05-12 21:18 ` luke at diamand 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).