strace to the rescue
So today I feel like a haxor.
My coworker was having an issue with Eclipse/EGit (on linux) and it was a very cryptic error message. So we ran an strace -p 1234 -p 1235 -p etc. -o strace.log -ff -q on his java process (not the eclipse process). I tried a trace with -e trace=file, but we did not get much in the logs. The full trace worked. We searched for git in the logs and found that his .gitconfig file was missing the [user] tag at the top. (After comparing to my .gitconfig file). We added the [user] to the top of his file and we got past the error! Yay! He had created the file by himself according to some instructions that we are going to CHANGE. LOL.
Here's a script to generate the tracer.sh command as seen above. This is provided as is with no warranty. Use/edit at your own risk.
#!/usr/bin/ksh
if [[ -z "$1" ]]
then
echo "Call this script with the process ID of eclipse or java."
exit
fi
pidlist=`ls -1 /proc/$1/task | sed s/^/\ -p\ / | sed s/$/\ \\\\\\\\/`
strace_cmd="strace -e trace=file $pidlist
-o strace.log -ff -q"
echo "strace_cmd is $strace_cmd"
echo "$strace_cmd" > tracer.sh
My coworker was having an issue with Eclipse/EGit (on linux) and it was a very cryptic error message. So we ran an strace -p 1234 -p 1235 -p etc. -o strace.log -ff -q on his java process (not the eclipse process). I tried a trace with -e trace=file, but we did not get much in the logs. The full trace worked. We searched for git in the logs and found that his .gitconfig file was missing the [user] tag at the top. (After comparing to my .gitconfig file). We added the [user] to the top of his file and we got past the error! Yay! He had created the file by himself according to some instructions that we are going to CHANGE. LOL.
Here's a script to generate the tracer.sh command as seen above. This is provided as is with no warranty. Use/edit at your own risk.
#!/usr/bin/ksh
if [[ -z "$1" ]]
then
echo "Call this script with the process ID of eclipse or java."
exit
fi
pidlist=`ls -1 /proc/$1/task | sed s/^/\ -p\ / | sed s/$/\ \\\\\\\\/`
strace_cmd="strace -e trace=file $pidlist
-o strace.log -ff -q"
echo "strace_cmd is $strace_cmd"
echo "$strace_cmd" > tracer.sh
can this be used with #!/bin/bash?
ReplyDeletei seem to only get:
ReplyDeletestrace: Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf: Operation not permitted