Skip to contentSkip to conversation

ptrace bug?

DISCUSSION Fabiano Ramos 1 participant 1 message May 6, 2004

lore
Share & tools
lore
#0 lore raw

Hi all.

I am using ptrace() from a user program (code at the end). The thing is, when tracing a snippet like:

0x0804869f:  8B 4D 0C                     mov	ecx, [ebp+12]
0x080486a2:  CD 80                        int	0x80
0x080486a4:  89 45 F8                     mov	[ebp-8], eax
0x080486a7:  83 7D F8 82                  cmp	[ebp-8], -126

it would print

0x080486a2
0x080486a7

which means it is not stopping after the syscall (int 0x80).

Am I missing something or is it the expected behaviour?

TIA
Fabiano

-----------------------------

	// wait for exec
	waitpid(pid,&wait_val,0);
	ptrace(PTRACE_SINGLESTEP,pid,NULL,NULL) < 0)

        waitpid(pid,&wait_val,0);

        while (1) {
                ptrace(PTRACE_GETREGS, pid, 0, (int)&regs);
	      	printf("\n 0x%08lx \n", regs.eip);
                
		ptrace(PTRACE_SINGLESTEP, pid, 0, 0);

                wait(&wait_val);
		if ( WIFEXITED(wait_val)) break;

         }