system-calls

Can I step into Python library code?

前提是你 提交于 2020-08-24 07:33:05
问题 When I run my Python debugger, I can step into functions that I write. But if I try to step into a library function like os.mkdir("folder") , for example, it "steps over" it instead. Is there a way to step into builtin library functions to see what Python is doing under the hood? Ideally there'd be a way to do this in PyPy so that you could keep drilling down into Python code. 回答1: pdb , the Python Debugger, cannot step into C functions like os.mkdir , but gdb can. Try this: gdb --args python

How to check if a forked process is still running from the c program

混江龙づ霸主 提交于 2020-08-19 11:50:00
问题 I have the pid of a forked process. Now, from my c code (running on Linux), I have to check periodically whether this process is still running or terminated. I do not want to use blocking calls like wait() or waitpid() . Need (preferably) a non-blocking system call which would just check whether this pid is still running and return the status of the child. What is best and easiest way to do it? 回答1: The waitpid() function can take the option value WNOHANG to not block. See the manual page, as

nasm system calls Linux

微笑、不失礼 提交于 2020-08-19 09:10:52
问题 I have got a question about linux x86 system calls in assembly. When I am creating a new assembly program with nasm on linux, I'd like to know which system calls I have to use for doing a specific task (for example reading a file, writing output, or simple exiting...). I know some syscall because I've read them on some examples taken around internet (such as eax=0, ebx=1 int 0x80 exit with return value of 1), but nothing more... How could I know if there are other arguments for exit syscall?

Golang: How to use syscall.Syscall on Linux?

霸气de小男生 提交于 2020-08-19 03:49:29
问题 There is a very nice description about loading a shared library and calling a function with the syscall package on Windows (https://github.com/golang/go/wiki/WindowsDLLs). However, the functions LoadLibrary and GetProcAddress that are used in this description are not available in the syscall package on Linux. I could not find documentation about how to do this on Linux (or Mac OS). Thanks for help 回答1: Linux syscalls are used directly without loading a library, exactly how depends on which