diff options
author | Juan Cespedes <cespedes@debian.org> | 2009-05-06 17:49:13 +0200 |
---|---|---|
committer | Juan Cespedes <cespedes@debian.org> | 2009-05-06 17:49:13 +0200 |
commit | 2c426c74d6e5e39e41c6c77c6f88ccea26748d72 (patch) | |
tree | bd640b0fb80694a3282a1778f4bcbcd6c5c6b43f | |
parent | da2ad5abe848571754a796774548981e3a687711 (diff) | |
download | ltrace-2c426c74d6e5e39e41c6c77c6f88ccea26748d72.tar.gz |
adding Process_State to struct Process
-rw-r--r-- | BUGS | 3 | ||||
-rw-r--r-- | TODO | 27 | ||||
-rw-r--r-- | ltrace.h | 10 |
3 files changed, 35 insertions, 5 deletions
@@ -1,8 +1,7 @@ -* Option -f sometimes fails to trace some children * Manual page is not accurate (config files...) -* Doesn't work with threads * Doesn't do inter-library calls (BP is in the executable's PLT) * It lacks support for several Linux archs, and many operating systems * 2008-12-29: this line in config file does not work (2nd argument not used): string setlocale(enum(LC_ALL=6), string); * 2009-04-07 fork() and clone() are not always followed +* 2009-04-07 doesn't work with threads (processes sharing memory) @@ -1,5 +1,3 @@ -* EVENT_FORK, EVENT_EXEC instead of fork_p() and exec_p() -* Get rid of EVENT_ARCH_SYSCALL and EVENT_ARCH_SYSRET * BFD: + New executable formats + Read list of libraries needed @@ -17,3 +15,28 @@ * More operating systems (solaris?) * Option -I (inter-library calls) * Modify ARGTYPE_STRING[0-5] types so that they not stop displaying chars when '\0' is encountered +* Get rid of EVENT_ARCH_SYSCALL and EVENT_ARCH_SYSRET +* EVENT_FORK, EVENT_CLONE, EVENT_EXEC instead of fork_p() and exec_p() +* If EVENT_FORK is received: + + Add the new process to the list, with a state of "future child of XXX" +* If EVENT_CLONE is received: + + Add the new process to the list, with a state of "future clone of XXX" +* If EVENT_EXEC is received: + + Clean structs with breakpoints, open new created program +* If a signal is received from an an unknown process, add it to the list, + with a state of "new process" +* Cleaner way to use breakpoints: + + BP is placed in the PLT + + When control hits there: + - write down return address + - change return address with another one (handled by ltrace) + - get arguments... + - change the process' PC to be in the correct place, + without removing breakpoint + + When control hits one of our return addresses: + - get return value... + - change PC to the right place +* To be able to work with processes sharing memory, we must: + + ptrace() every single thread + + place breakpoints only in places where the process control can continue + without having to remove it @@ -152,9 +152,17 @@ struct callstack_element { #define MAX_CALLDEPTH 64 -typedef struct Process Process; +typedef enum Process_State Process_State; +enum Process_State { + STATE_ATTACHED, + STATE_NEW, + STATE_FUTURE_CHILD, + STATE_FUTURE_CLONE +}; +typedef struct Process Process; struct Process { + Process_State state; char *filename; pid_t pid; struct dict *breakpoints; |