sigtrap and TF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

why if i put TF in my prog and install an handler to SIGTRAP the
handler is not caught?
this is the test code:
.data

str:
        .string "fuck\n\n"

.text
.globl suck

suck:

        nop
        pushf
        xor %rax, %rax
        pop %rax
        orq $0x100, %rax
        pushq %rax
        popf
        nop
        nop
        movq $str, %rdi
        movq $0, %rax
        call printf
        call exit

and the main is:

#include <stdio.h>
#include <signal.h>

int i=0;

void
handler(int n) {

        i=1;
}

void
install_sigtrap_handler() {

        struct sigaction sa;
        sa.sa_sigaction = handler;
        sa.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
        sigemptyset(&sa.sa_mask);

        if(sigaction(SIGTRAP, &sa, NULL))
                printf("sigaction error\n");
}


void
test_trap() {

    __asm__ __volatile__ ( "int3\n\t");

}

int
main() {

        install_sigtrap_handler();
//      signal(SIGTRAP, handler);
//      test_trap();
        suck();

        if(i)
                printf("ok\n");
}

thanks.

-- 
noone is alone.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux