This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug tapsets/19489] New: printing array from memory
- From: "josch at mister-muffin dot de" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Mon, 18 Jan 2016 13:50:06 +0000
- Subject: [Bug tapsets/19489] New: printing array from memory
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19489
Bug ID: 19489
Summary: printing array from memory
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: tapsets
Assignee: systemtap at sourceware dot org
Reporter: josch@mister-muffin.de
Target Milestone: ---
Hi,
consider the following C program:
#include <unistd.h>
int main()
{
char buffer[7] = {'f', 'o', 'o', 'b', 'a', 'r', '\n'};
write(1, buffer, 7);
char buffer2[2] = {'\0', '\n'};
write(1, buffer2, 2);
return 0;
}
and the following systemtap script:
probe syscall.write {
if (!target_set_pid(pid())) next;
printf("%s %s\n", name, argstr)
printf("%*M\n", $count, $buf);
}
execute like so:
$ sudo stap -v stdoutbuf.stp -o out -c "./a.out"
I'd expect the file `out` to contain the following content:
write 1, "foobar\n", 7
666f6f6261720a
write 1, "\000\n", 2
000a
Instead I get
write 1, "foobar\n", 7
66
write 1, "", 2
00
Notice the two problems:
1. apparently the argstr cannot handle the zero byte and instead of octal
encoding it, it just truncates the string.
2. printf("%*M") is not printing the full string
System information:
Operating system: Debian unstable
Kernel version: 4.4.0-rc8-amd64
Architecture: amd64
Systemtap version: 2.9/0.163, Debian version 2.9-2
gcc version: 5.2.1 20151028 (Debian 5.2.1-23)
--
You are receiving this mail because:
You are the assignee for the bug.