1

I want to debug like:

strace -fe open python /usr/bin/gnome-tweak-tool 2>>/tmp/hello.log

strace -fe open python /usr/bin/gnome-tweak-tool 2>>/tmp/hello2.log

Then use kdiff3 to compare both logs, but different pids will make this comparison useless: enter image description here

So my question is there any option from strace to exclude such -f pid ?

2 Answers 2

3

One could log the outputs of the different pids to different files via the -ff -o filename options:

strace -o foo -ff -e open  perl -e fork
strace -o bar -ff -e open  perl -e fork

and then compare the appropriate foo.<pidnum> and bar.<pidnum> files.

1
  • A side note, cat bar* > mybar && cat foo* > myfoo && kdiff3 mybar myfoo to compare in one step.
    – 林果皞
    May 9, 2016 at 19:36
1
sed -r -e 's/^(.+)pid [0-9]+(.+)$/\1pid-xxxx\2/;' -i /tmp/hello2.log

or filter it same way from output.

5
  • I don't get what should be replace for this pid-xxxx. Empty output when i run sed -r -e 's/pid-[0-9]+/pid-12625/;' -i hello3.log which 12625 is one of the pid in this file. And there are a lot of pids and i need to figure out the unqiue pids one by one?
    – 林果皞
    May 9, 2016 at 16:36
  • @林果皞 ohh, sorry, my bad, test file not like yours. Changed, should work this time.
    – MolbOrg
    May 9, 2016 at 16:42
  • pid-xxxx is just any token, you may set it to empty, just something equal for both files - it will make diff happy
    – MolbOrg
    May 9, 2016 at 16:47
  • The hello3.log doesn't change(should i expect [pid 12606] +++ exited with 0 +++ will shrink to +++ exited with 0 +++ ?) and empty output in terminal when i run sed -r -e 's/^(.+)pid-[0-9]+(.+)$/\1pid-12606\2/;' -i ./hello3.log, my sed version is sed (GNU sed) 4.2.2
    – 林果皞
    May 9, 2016 at 16:53
  • @林果皞 yes definitely, because pid 12606 is't same as pid-12606, sorry again, checked on strace output this time, edited, should work this time. huh.
    – MolbOrg
    May 9, 2016 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.