fche changed the topic of #systemtap to: http://sourceware.org/systemtap; email systemtap@sourceware.org if answers here not timely, conversations may be logged
sscox has quit [Ping timeout: 260 seconds]
sscox has joined #systemtap
hpt has joined #systemtap
hpt has quit [Ping timeout: 250 seconds]
hpt has joined #systemtap
hpt has quit [Ping timeout: 265 seconds]
hpt has joined #systemtap
hpt has quit [Ping timeout: 265 seconds]
hpt has joined #systemtap
hpt has quit [Ping timeout: 264 seconds]
hpt has joined #systemtap
<Amy1> how to use condition compile?
<Amy1> I want to implement something like #if var == 1 code1 #else code2 #endif in C language.
_whitelogger has joined #systemtap
_whitelogger has joined #systemtap
khaled has joined #systemtap
khaled has quit [Quit: Konversation terminated!]
khaled has joined #systemtap
Amy1 has quit [Quit: WeeChat 2.2]
hpt has quit [Ping timeout: 265 seconds]
mjw has joined #systemtap
Amy1 has joined #systemtap
Amy1 has quit [Client Quit]
Amy1 has joined #systemtap
<Amy1> fche: in?
orivej has quit [Ping timeout: 256 seconds]
sapatel has joined #systemtap
amerey has joined #systemtap
tromey has joined #systemtap
<Amy1> how to make embedded C code to read variables defined in source code ?
<fche> Amy1, not directly from embedded-C
<Amy1> oh.. I know I can pass from script
<fche> but function foo (value:long) %{ THIS_value; .... %} probe bar { foo($var) }
<Amy1> yeah, I know thi
<Amy1> this
<Amy1> why not develop a function to instrument some code into source code or responding assembly code?
<fche> depends on details
<fche> at run time, we don't have the info re. debuginfo etc. that we do at translate time
<Amy1> how to source code with embedded-C?
<Amy1> expand source code with embedded-C
<Amy1> I want to the complete code with embedded-C
<fche> not sure what you mean 'expand'
<Amy1> I want to see the complete code with embedded-C. expand like macro expand
<fche> the complete code of what?
<fche> stap -p3 shows all the generated C code from all the stp code, including embedded-C function bodies
sscox has quit [Ping timeout: 256 seconds]
<Amy1> ss 2: analyzed script: 2 probes, 8 functions, 2 embeds, 2 globals using 219932virt/22328res/4908shr/17684data kb, in 0usr/10sys/18real ms.
<Amy1> Pass 2: analysis failed. [man error::pass2]
<Amy1> Running rm -rf /tmp/stapZ1uzKA
<Amy1> Spawn waitpid result (0x0): 0
<Amy1> Removed temporary directory "/tmp/stapZ1uzKA"
<Amy1> when stap -vvv failed, how to keep /tmp/stapZ1uzKA instead of removing it?
<fche> stap -k
<fche> (keep tmpdir)
<Amy1> cool
<Amy1> but it's empty
<Amy1> nothing stored
<fche> during pass 2, no temp files are created yet, it's too early
<fche> -p3 etc., there'd be code there
<Amy1> Pass 2: analyzed script: 2 probes, 8 functions, 2 embeds, 2 globals using 219932virt/22320res/4908shr/17684data kb, in 0usr/10sys/17real ms.
<Amy1> Pass 2: analysis failed. [man error::pass2]
<Amy1> Keeping temporary directory "/tmp/stap9w8BNM"
<Amy1> My script has an error
<fche> surely there is some error before that point?
<Amy1> If has an error, break on pass2, then will not generate temporay. Only going to pass 3, can generate temporary.
<Amy1> yes
<Amy1> I want to see the temporary to debug
<Amy1> ERROR: probe overhead exceeded threshold
<Amy1> WARNING: Number of errors: 1, skipped probes: 0
<Amy1> WARNING: /usr/bin/staprun exited with status: 1
<Amy1> So what about this bug?
<fche> see man error::pass5
<Amy1> How to implement something like #if var == 1 code1 #else code2 #endif in C language.
<fche> what var is this?
<fche> in embedded c you can use preprocessor stuff like that
<fche> but 'var' values must be preprocessor macro symbols
<Amy1> In stp script probe, probe process { %( 1 !=2 %? code1 %?code2 %) }
<Amy1> I had known this.
<Amy1> but I don't know how to compare a variable num !=2
<fche> preprocessors must deal with preprocessor-time values, not run-time or context stuff
<fche> what is 'num' ?
<Amy1> a custom variable
<Amy1> how to define it
<fche> sorry that doesn't help me, what do you mean by custom variable?
<Amy1> like #define xx 5
<fche> ok so a c level macro
<fche> so you can put that into an embedded c block
<Amy1> No, I want to write it in probe
<Amy1> I want to use xx to control compile which code
<Amy1> something like C marco, but not C macro used in embedded C code, I want to use in stp probe code.
<Amy1> %( 1 !=2 %? code1 %?code2 %)
<Amy1> I can modify 1 to 2 to control compile code2
<Amy1> I want to replace "1" to a variable, so that I can control much more
<Amy1> %( num != 67 %? code1 %?code2 %)
<Amy1> I don't know how to define "num"
<fche> well, how about if() else ?
<Amy1> if() else running in runtime?
<Amy1> or compile time?
<fche> run time - if it's a runtime variable, it has to be run then
<Amy1> Not I want, run time bring too much cost
<Amy1> why not incroduce #define xxx into stp script
<fche> global xxx = 5
<fche> that exists
<Amy1> it is in runtime
<fche> but that's a runtime variable again not a translate-time one
<fche> you could try using the macro facility for this
<fche> stap's own
<Amy1> how to express?
<fche> @define NAME %( BODY %)
<fche> see [man stap]
<Amy1> coulde @define xx %( 1 %)
<Amy1> @define xx %( 1 %)
<fche> should work
<Amy1> %( xx !=2 %?
<fche> @xx
<Amy1> cool
<Amy1> that's what I want.
<Amy1> fche: thank you very much
<fche> glad we figured it out :)\
<Amy1> semantic error: target-symbol requires debuginfo: identifier '$j' at :33:48
<Amy1> thrown from: tapsets.cxx:6678
<Amy1> source: printf(" i %d j %d\n",$i,$j);
<Amy1> how about this bug?
<Amy1> when I use -O0 -g, it solved
<Amy1> but I want to use -O2
sscox has joined #systemtap
<fche> use -O2 -g
<Amy1> also error
<fche> you'll need to give more complete info about how you're compiling, what the target c program is, and what the stap script is
<Amy1> wait a minit
<Amy1> minite
<Amy1> it is source code.
<Amy1> stap -g print.stp "MD" -c ./MD
<Amy1> probe process(@1).statement("*@add_pairwise.c:261")
<Amy1> {
<Amy1> printf("i %d j %d\n",$i,$j);
<Amy1> }
<Amy1> ~
<Amy1> -g -O0 can print i and j
<Amy1> -g -O2 print an error as:
<fche> hm, j is out of scope by line 261
<fche> or maybe it isn't
<Amy1> gcc -g -O2 -fopenmp -o MD MD.o control.o util.o add_pairwise.o -lm
<Amy1> MD.bin
<Amy1> semantic error: no line records for /root/MD/C/add_pairwise.c:261 [man error::dwarf]
<Amy1> semantic error: while resolving probe point: identifier 'process' at print.stp:4:7
<Amy1> source: probe process(@1).statement("*@add_pairwise.c:261")
<Amy1> ^
<fche> but yeah compiler optimizers can nuke variables sometimes
<Amy1> semantic error: no match
<Amy1> Pass 2: analysis failed. [man error::pass2]
<fche> stap -L 'process("MD").statement("*@add_pairwise.c:*")'
<Amy1> nothing
<fche> stap -L 'process("MD").statement("*@*:*")' why not
<fche> you will need -g in CFLAGS
<Amy1> but I think i and j should not be optimized, beause they are loop iterator, right?
<Amy1> if -g -O2 print the error, it seems stap's use was limited
<Amy1> cool
<Amy1> ERROR: probe overhead exceeded threshold
<Amy1> WARNING: Number of errors: 1, skipped probes: 0
<Amy1> WARNING: /usr/bin/staprun exited with status: 1
<Amy1> fche: so back again, does this mean that probe code cost is too high?
<fche> yes
<fche> so see man error::pass5 for stap options that can suppress these various safety checks
sapatel has quit [Remote host closed the connection]
<Amy1> why introducing this forbid?
<Amy1> which situation need this check?
<fche> it protects a system from accidentally overzealous probing that could bog the system down
sapatel has joined #systemtap
<Amy1> cool
<Amy1> I want to follow the development
<Amy1> So how do I learn quickly to join it?
<Amy1> Is there good materials?
<Amy1> about source code study
sscox has quit [Ping timeout: 260 seconds]
sscox has joined #systemtap
sscox has quit [Ping timeout: 260 seconds]
orivej has joined #systemtap
sscox has joined #systemtap
mjw has quit [Quit: Leaving]
irker150 has joined #systemtap
<irker150> systemtap: fche systemtap.git:master * release-4.2-56-g26a7caa17 / elaborate.cxx session.cxx: RHBZ1795159: unbreak java.exp test cases
<irker150> systemtap: fche systemtap.git:master * release-4.2-55-g2f35e5431 / testsuite/systemtap.base/listing_mode_sanity.exp: testsuite: listing_mode_sanity.exp: update for new vfs_read() signature
sapatel has quit [Remote host closed the connection]
sapatel has joined #systemtap
tromey has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
amerey has quit [Quit: Leaving]
irker150 has quit [Quit: transmission timeout]
sapatel has quit [Remote host closed the connection]