fche changed the topic of #systemtap to: http://sourceware.org/systemtap; email systemtap@sourceware.org if answers here not timely, conversations may be logged
derek0883 has quit [Remote host closed the connection]
sapatel has quit [Ping timeout: 265 seconds]
hpt has joined #systemtap
orivej has quit [Ping timeout: 265 seconds]
derek0883 has joined #systemtap
<derek0883> HI I have probe at libc fread, print($$parms) give me; p=0x7fffffffdd90 mode=0x555555a3e0c0, the definition of FILE *fopen(const char *pathname, const char *mode);
<derek0883> how can I get the pathname as string, user_string($p) give me something like UUU or VUA
<derek0883> WARNING: never-assigned local variable 'retval': identifier 'retval'
<derek0883> probe process("/lib/x86_64-linux-gnu/libc.so.6").function("fopen*").return { printf("%s ret: %d\n", ppfunc(), retval);}
<derek0883> Why I always got 0, in this retval, and systemtap throw a warning retval never assigned
_whitelogger has joined #systemtap
khaled has joined #systemtap
yogananth has joined #systemtap
derek0883 has quit [Ping timeout: 240 seconds]
orivej has joined #systemtap
<fche> isinstr()
tromey has joined #systemtap
hpt has quit [Ping timeout: 258 seconds]
sapatel has joined #systemtap
amerey has joined #systemtap
sscox has quit [Ping timeout: 252 seconds]
sscox has joined #systemtap
sscox has quit [Ping timeout: 260 seconds]
jhg_ has quit [Ping timeout: 240 seconds]
sscox has joined #systemtap
jhg_ has joined #systemtap
sscox has quit [Ping timeout: 256 seconds]
sscox has joined #systemtap
derek0883 has joined #systemtap
<derek0883> Hello, I use systemtap to trace fopen of libc, I found static linked version works, but shared library doesn't, the asm code like this: jmpq 0x555555581fe0 <fopen@plt>
<derek0883> for those call, my system tap didn't catch it.
<fche> derek0883,
<fche> how are you probing it?
<derek0883> probe process("/lib/x86_64-linux-gnu/libc.so.6").function("_IO_new_fopen") { printf("%s file %s\n", ppfunc(), user_string($filename)); }
<fche> hm, it's roughly working for me here
<fche> # stap -e 'probe process("/lib64/libc.so.6").function("*fopen") { printf("%s file %s\n", ppfunc(), @defined($filename)?user_string($filename):""); }' -x 3989624
<derek0883> I use gdb without "systemtap" running, for those file that systemtap can catch, "b fopen", I found the asm code is something like this: 0x7ffff55c886a <__tzfile_read+282> callq 0x7ffff5572e30 <_IO_new_fopen>
<fche> where that last number is pid of a normal shell
<fche> there is an _IO_new_fopen and a _IO_new_file_fopen pair on my f31 version of glibc
<derek0883> same here it is _IO_new_fopen, on ubuntu 18.04
derek0883 has quit [Remote host closed the connection]
derek0883 has joined #systemtap
<derek0883> fche, same here on my ubuntu 18.04, it is can only catch some of fopen,
<derek0883> I mean same here, the name is _IO_new_fopen and _IO_new_file_fopen
<fche> and are you sure your workload process is calling this function?
<fche> stap -v -p2 can tell you e.g. where stap finds the probe points in terms of virtual addresses
<fche> so can match up the gdb breakpoint address
<fche> wouldn't expect a bug there.... weird.
<fche> you could doing a broader wildcard probe of glibc functions function("*").call and watch for the part triggered by your workload's fopen (?) call
derek088_ has joined #systemtap
<derek0883> Yes, I'm sure, event use systemtap, if I changed to sys_open, I can catch that file
<derek0883> Let me try your hint, thanks!
<fche> hm that's the syscall level
<fche> eventually it comes through there, yeah
<derek0883> fche systemtap will also catch each child process, right?
<fche> yes
<derek0883> HI fche, after my program called daemon; ( standard c function int daemon(int nochdir, int noclose);) systemtap couldn't catch fopen anymore
<derek0883> if I comment out daemon(1, 0), then systemtap able to catch all fopen call
<fche> not sure why that would be
<fche> the syscall level should work regardless
<derek0883> Not sure why, But I can repeat reproduce this with a simple Helloword program,
<derek0883> on my ubuntu 18.04, Systemtap translator/driver (version 4.3/0.170, commit release-4.2-65-g6de9136a2794 + changes)
<derek0883> fche are you curious to take a quick look? I can upload my simple helloworld program to somewhere?
<fche> how are you invoking your stap script?
<derek0883> I'll upload my script and my simple program with a readme
<fche> are you running stap -x PID or stap -c CMD or stap (with no constraint) ?
<derek0883> I put it in a .stp file with this on top, #!/usr/local/bin/stap -vg, then I run in bash sudo ./daemon.stp
<fche> ok
<derek0883> probe process("/lib/x86_64-linux-gnu/libc.so.6").function("*fopen") { printf("%s %s file %s\n", execname(), ppfunc(), @defined($filename)?user_string($filename):"");}
<fche> so not constrained to a particular process.
<fche> daemon() fork/exec's , that's why I asked
<derek0883> the content of my script is like this
<derek0883> fche Could you please try this link?
<fche> derek0883, it'll need to wait, sorry, heads down in another piece of work
<derek0883> No problem, Thanks!
derek088_ has quit [Remote host closed the connection]
derek088_ has joined #systemtap
SierraSkye has joined #systemtap
SierraSkye has quit [Client Quit]
zodbot has quit [Read error: Connection reset by peer]
zodbot has joined #systemtap
tromey has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
ElizabethCo has joined #systemtap
ElizabethCo has quit [Client Quit]
amerey has quit [Remote host closed the connection]
derek0883 has quit [Remote host closed the connection]
derek0883 has joined #systemtap
derek0883 has quit [Remote host closed the connection]
derek0883 has joined #systemtap
derek088_ has quit [Ping timeout: 252 seconds]
sapatel has quit [Ping timeout: 264 seconds]