Version: 0.3.11
* Clean up lintian bugs
* Fixed small bug reading start of arguments in config file
* Keep a stack of nested calls (Morten Eriksen, 1999-07-04)
* Add "--indent" option (Morten Eriksen, 1999-07-04)
* cleans up connection between a breakpoint address and
a call instance (Morten Eriksen, 1999-07-04)
* New Standards-Version (3.5.5)
diff --git a/sysdeps/linux-gnu/arm/breakpoint.c b/sysdeps/linux-gnu/arm/breakpoint.c
index 2e80739..446c38b 100644
--- a/sysdeps/linux-gnu/arm/breakpoint.c
+++ b/sysdeps/linux-gnu/arm/breakpoint.c
@@ -5,7 +5,7 @@
#include <sys/ptrace.h>
#include "ltrace.h"
-void insert_breakpoint(pid_t pid, struct breakpoint * sbp)
+void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
{
int a;
@@ -18,7 +18,7 @@
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
}
-void delete_breakpoint(pid_t pid, struct breakpoint * sbp)
+void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
{
int a;
diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
index 6647458..49d2f20 100644
--- a/sysdeps/linux-gnu/arm/trace.c
+++ b/sysdeps/linux-gnu/arm/trace.c
@@ -46,11 +46,11 @@
}
-void continue_after_breakpoint(struct process *proc, struct breakpoint * sbp, int delete_it)
+void continue_after_breakpoint(struct process *proc, struct breakpoint * sbp)
{
- delete_breakpoint(proc->pid, sbp);
+ if (sbp->enabled) disable_breakpoint(proc->pid, sbp);
ptrace(PTRACE_POKEUSER, proc->pid, off_pc, sbp->addr);
- if (delete_it) {
+ if (sbp->enabled == 0) {
continue_process(proc->pid);
} else {
proc->breakpoint_being_enabled = sbp;
diff --git a/sysdeps/linux-gnu/i386/breakpoint.c b/sysdeps/linux-gnu/i386/breakpoint.c
index ce235c8..0589d3c 100644
--- a/sysdeps/linux-gnu/i386/breakpoint.c
+++ b/sysdeps/linux-gnu/i386/breakpoint.c
@@ -3,24 +3,27 @@
#endif
#include <sys/ptrace.h>
+#include <assert.h>
#include "ltrace.h"
-void insert_breakpoint(pid_t pid, struct breakpoint * sbp)
+void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
{
int a;
a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
+ assert((a & 0xFF) != 0xCC);
sbp->orig_value[0] = a & 0xFF;
a &= 0xFFFFFF00;
a |= 0xCC;
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
}
-void delete_breakpoint(pid_t pid, struct breakpoint * sbp)
+void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
{
int a;
a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
+ assert((a & 0xFF) == 0xCC);
a &= 0xFFFFFF00;
a |= sbp->orig_value[0];
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
diff --git a/sysdeps/linux-gnu/i386/trace.c b/sysdeps/linux-gnu/i386/trace.c
index 15c0361..ce3e5ad 100644
--- a/sysdeps/linux-gnu/i386/trace.c
+++ b/sysdeps/linux-gnu/i386/trace.c
@@ -22,24 +22,29 @@
*/
int syscall_p(struct process * proc, int status, int * sysnum)
{
+ int depth;
+
if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*ORIG_EAX, 0);
if (*sysnum>=0) {
- if (proc->current_syscall!=*sysnum) {
- return 1;
- } else {
+ depth = proc->callstack_depth;
+ if (depth>0 &&
+ proc->callstack[depth-1].is_syscall &&
+ proc->callstack[depth-1].c_un.syscall==*sysnum) {
return 2;
+ } else {
+ return 1;
}
}
}
return 0;
}
-void continue_after_breakpoint(struct process *proc, struct breakpoint * sbp, int delete_it)
+void continue_after_breakpoint(struct process *proc, struct breakpoint * sbp)
{
- delete_breakpoint(proc->pid, sbp);
+ if (sbp->enabled) disable_breakpoint(proc->pid, sbp);
ptrace(PTRACE_POKEUSER, proc->pid, 4*EIP, sbp->addr);
- if (delete_it) {
+ if (sbp->enabled == 0) {
continue_process(proc->pid);
} else {
proc->breakpoint_being_enabled = sbp;
diff --git a/sysdeps/linux-gnu/m68k/breakpoint.c b/sysdeps/linux-gnu/m68k/breakpoint.c
index 3bf427f..46c84ce 100644
--- a/sysdeps/linux-gnu/m68k/breakpoint.c
+++ b/sysdeps/linux-gnu/m68k/breakpoint.c
@@ -5,7 +5,7 @@
#include <sys/ptrace.h>
#include "ltrace.h"
-void insert_breakpoint(pid_t pid, struct breakpoint * sbp)
+void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
{
int a;
@@ -17,7 +17,7 @@
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
}
-void delete_breakpoint(pid_t pid, struct breakpoint * sbp)
+void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
{
int a;
diff --git a/sysdeps/linux-gnu/m68k/trace.c b/sysdeps/linux-gnu/m68k/trace.c
index 0485860..8d8af67 100644
--- a/sysdeps/linux-gnu/m68k/trace.c
+++ b/sysdeps/linux-gnu/m68k/trace.c
@@ -22,25 +22,30 @@
*/
int syscall_p(struct process * proc, int status, int * sysnum)
{
+ int depth;
+
if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_ORIG_D0, 0);
if (*sysnum == -1) return 0;
if (*sysnum>=0) {
- if (proc->current_syscall!=*sysnum) {
- return 1;
- } else {
+ depth = proc->callstack_depth;
+ if (depth>0 &&
+ proc->callstack[depth-1].is_syscall &&
+ proc->callstack[depth-1].c_un.syscall==*sysnum) {
return 2;
+ } else {
+ return 1;
}
}
}
return 0;
}
-void continue_after_breakpoint(struct process *proc, struct breakpoint * sbp, int delete_it)
+void continue_after_breakpoint(struct process *proc, struct breakpoint * sbp)
{
- delete_breakpoint(proc->pid, sbp);
+ if (sbp->enabled) disable_breakpoint(proc->pid, sbp);
ptrace(PTRACE_POKEUSER, proc->pid, 4*PT_PC, sbp->addr);
- if (delete_it) {
+ if (sbp->enabled == 0) {
continue_process(proc->pid);
} else {
proc->breakpoint_being_enabled = sbp;
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index fd2c1a7..bc032d8 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -76,6 +76,6 @@
void continue_enabling_breakpoint(pid_t pid, struct breakpoint * sbp)
{
- insert_breakpoint(pid, sbp);
+ enable_breakpoint(pid, sbp);
continue_process(pid);
}