It can be useful I think. Trying this on my toy project. This is a single thread program so it cannot do syscall from multiple cores. It is not very helpful without debug info: nanosleep({tv_sec=1, tv_nsec=299127292}, NULL) = 0 > /home/spcharc/proj/out() [0x80f1] write(1, "g1() ===== end =====\n", 21g1() ===== end ===== ) = 21 > /home/spcharc/proj/out() [0x80f1] munmap(0x7a267b491000, 66580) = 0 > /home/spcharc/proj/…
Finding out where syscalls are called from: Stack traces with strace
11–17 of 17 posts
Re: Finding out where syscalls are called from: Stack traces with strace
#12strace is a rather powerfull tool if you want to find out what a certain executable is doing. Which files it is opening, reading and writing and also which other executables it is executing. I personally have not used the '--stack-trace' option yet. Earlier this year, I have used it to analyze what happens during the initial steps of live-bootstrap [1] and produce a web page with all the information [2]. For this, I…
Re: Finding out where syscalls are called from: Stack traces with strace
#13strace is a rather powerfull tool if you want to find out what a certain executable is doing. Which files it is opening, reading and writing and also which other executables it is executing. I personally have not used the '--stack-trace' option yet. Earlier this year, I have used it to analyze what happens during the initial steps of live-bootstrap [1] and produce a web page with all the information [2]. For this, I…
What flags do you use when you just want to see the files that are being opened? I'm always grepping, but there must be an easier way.
If you want to see all file-related calls, replace "open" with "file" or you could add the calls one by one: e.g., trace=open,read.
Re: Finding out where syscalls are called from: Stack traces with strace
#14Re: Finding out where syscalls are called from: Stack traces with strace
#15One of the great strengths of strace as a debugging tool is that it shows you what a program is doing regardless of whether it was compiled with debug info or not. The downside of this is that you only see the program’s syscall. You can use this information to deduce what is happening in the program but you don’t see from where in the program those syscalls originate...
Why did you just quote the start of the article?
Re: Finding out where syscalls are called from: Stack traces with strace
#16It can be useful I think. Trying this on my toy project. This is a single thread program so it cannot do syscall from multiple cores. It is not very helpful without debug info: nanosleep({tv_sec=1, tv_nsec=299127292}, NULL) = 0 > /home/spcharc/proj/out() [0x80f1] write(1, "g1() ===== end =====\n", 21g1() ===== end ===== ) = 21 > /home/spcharc/proj/out() [0x80f1] munmap(0x7a267b491000, 66580) = 0 > /home/spcharc/proj/…
Does your main have an assert(false) after the main loop? If so the return address could be set to the assert function as some kind of optimization.
Actually I call syscalls from assembly, and my _start() is also an assembly function. That is why this happens I guess. strace somehow doesn't play well with code written in .s file?
Re: Finding out where syscalls are called from: Stack traces with strace
#17Earlier quoted context omitted.
Does your main have an assert(false) after the main loop? If so the return address could be set to the assert function as some kind of optimization.
I do have a couple of asserts in my code, but that does not explain why every stack trace begins and ends with "assert()" Actually I call syscalls from assembly, and my _start() is also an assembly function. That is why this happens I guess. strace somehow doesn't play well with code written in .s file?