2011-02-14 02:43:40     SIGTRAP while debugging gdb

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-02-14 02:43:40     SIGTRAP while debugging gdb

Mahalakshmi M (INDIA)

Message: 98127   

 

Hi,

 

I am using 2009R1-RC7 toolchain and 2009R1-RC1 Kernel.

 

I have enabled the following options in the kernel

 

                                        [*] KGDB: use kgdb over the serial console (NEW)

 

                                        [*] gdbserver (old)

 

Do i need to enable any other options for debugging gdb- insight?

 

My Application is multithreaded. While running gdb in my application i can able to keep breakpoint and step through till  pthread_create() function. After that if i keep breakpoint in DBMain() i am getting "SIGTRAP trace breakpoint trap" . How to overcome this error. After this i can able to debug my application.

 

 

 

int main(void)

{

 

        pthread_attr_init(&Thread_Attribute);

 

         pthread_attr_setstacksize(&Thread_Attribute, UI_STACKSIZE);

        pthread_attr_setschedpolicy(&Thread_Attribute,SCHED_RR);

 

        st_Scheduler_Parameter.sched_priority = UI_PRIORITY;

 

        pthread_attr_setschedparam(&Thread_Attribute,&st_Scheduler_Parameter);

 

        pthread_create(&PThread_ID, &Thread_Attribute, &DBMain, NULL);

 

        while(1)

        {

                usleep(5000000);//let the main not exit

        }

 

}

 

 

 

 

int DBMain(char *bdbPath)

{

        int ret;

        char lpCmdLine[2048]="";

    

 

   printf(" i am here in GoDBMain \n");

 

 

function1();

}

 

In my target setting i have enabled the following:

handle SIGINT nostop noprint pass;set solib-search-path /lib

QuoteReplyEditDelete

 

 

2011-02-14 02:49:30     Re: SIGTRAP while debugging gdb

Mike Frysinger (UNITED STATES)

Message: 98128   

 

kgdb is only needed if you want to debug the kernel itself.  it has no bearing on userspace application debugging.

 

"SIGTRAP" usually means the app keeps hitting a breakpoint.  this isnt an error if you've set breakpoints on things.

 

2009R1 is pretty old.  you should be using the latest release -- 2010R1.

 

please post actual transcripts of your debugging session.

QuoteReplyEditDelete

 

 

2011-02-14 05:05:55     Re: SIGTRAP while debugging gdb

Mahalakshmi M (INDIA)

Message: 98155   

 

I am using Xming for debugging session. Please find the target settings for this as follows.

 

Target : GDBServer\TCP

 

Host Name: 172.16.0x.0y

 

Port: 1234

 

Target Settings:    handle SIGINT nostop noprint pass;set solib-search-path lib/

 

In putty i have configured SSH X11 forwarding.

 

 

 

Actually , While running gdb in my application i can able to keep breakpoint and step through till  pthread_create() function.The very next breakpoint i kept was at function DBMain() which is the run function of the above  pthread_create(). . At this time i am getting "SIGTRAP trace breakpoint trap" . If this is not the problem it should reach DBMain() after sometime right. but i am not getting that ..

 

 

 

int main(void)

{

          pthread_create(&PThread_ID, &Thread_Attribute, &DBMain, NULL);

        while(1)

        {

                usleep(5000000);//let the main not exit

        }

}

 

 

int DBMain(char *bdbPath)

{

        int ret;

        char lpCmdLine[2048]="";

      printf(" i am here in DBMain \n");

function1();

}

 

Will it be due to 2009R1?

Attachments

    Outcomes