2007/12/5, Rene Herman <[EMAIL PROTECTED]>:
> On 05-12-07 15:23, ninjaboy wrote:
>
> > why if i put TF in my prog and install an handler to SIGTRAP the
> > handler is not caught?
>
> Works for me.
>
> Rene.
>
> /* gcc -W -Wall -o sigtrap sigtrap.c */
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <signal.h>
>
> volatile sig_atomic_t trap;
>
> void sigtrap(int signum __attribute__((unused)))
> {
> trap = 1;
> }
>
> int main(void)
> {
> struct sigaction sa;
>
> sa.sa_handler = sigtrap;
> sigemptyset(&sa.sa_mask);
> sa.sa_flags = 0;
>
> if (sigaction(SIGTRAP, &sa, NULL) < 0) {
> perror("could not install handler");
> return EXIT_FAILURE;
> }
>
> asm("int3");
>
> printf("trap = %d\n", (int)trap);
> return EXIT_SUCCESS;
> }
>
>
Ehm... int3 works for me too, the TF doesn't work.
pushf
xor %rax, %rax
pop %rax
orq $0x100, %rax
pushq %rax
popf
the trap released here doesn't exec my handler.
--
noone is alone.
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ