• Register
0 votes
808 views

Problem :

I am debugging the piece of (embedded) software. I have already set a breakpoint on the function, and for some reason, once I have reached that a breakpoint and continue I always come back to a function (which is an initialisation function which should only be called once). When I remove a breakpoint, and continue, GDB tells me:

“Program received signal SIGTRAP, Trace/breakpoint trap.”

Since I was working with the breakpoints, I am assuming I fell in the "breakpoint trap". What is the breakpoint trap?

3.9k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

A breakpoint trap just means that the processor has hit the breakpoint. There are two possibilities for why this may be happening. Most likely, the initialization code is being hit because of the CPU is resetting and hitting a breakpoint again. The other possibility would be that a code where you set a breakpoint is actually run in places other than the initialization. Sometimes with a aggressive compiler optimization it can be very hard to tell exactly which code the breakpoint maps to and which execution paths will get there.

OR

The other possibility that I can think of is:

  1. The process is running more than the one thread.

             For example - 2 say T1 & T2.

  1. Thread T2 hits a break point but you have the attached gdb to thread T1.

            This case is the Trace/breakpoint trap.

38.6k points

Related questions

0 votes
1 answer 36 views
36 views
Problem: I just finished installing gdb and now I need to debug a project I have for my uni. It seems that none of my code works I am asking foe help.
asked Apr 28 salim1 60.6k points
0 votes
1 answer 8 views
8 views
Problem : How do I solve it: During startup program terminated with signal, unknown signal?
asked Jun 21 Sifat55 108k points
0 votes
1 answer 16 views
16 views
Problem : Is this something that other people have experienced : Trace/breakpoint trap (core dumped)
asked May 26 Siam55 110k points
0 votes
1 answer 10 views
10 views
Problem: Asked few friends but no solution, please help : Can a variable be both constant and volatile?
asked May 29 Yeamin 23.5k points
0 votes
1 answer 92 views
92 views
Problem: Please can anyone tell me the right procedure to do it? Integer to string in c without itoa
asked Apr 19 Ifra 43.4k points
0 votes
1 answer 17 views
17 views
Problem: Difference between step and next in gdb.
asked Jul 21 Aurelia Maja 78.4k points
0 votes
1 answer 5 views
5 views
Problem: No symbol table is loaded use the file command/
asked Jul 4 Priscilla Gurpreet 74.7k points
0 votes
1 answer 10 views
10 views
Problem: Not in executable format file format not recognized
asked Jun 28 asha 121k points
0 votes
1 answer 20 views
20 views
Problem: Failed to read a valid object file image from memory
asked Jun 27 asha 121k points
0 votes
1 answer 16 views
16 views
Problem: So, what precisely is the problem here : Gdb not in executable format file format not recognized?
asked Jun 25 Mezbah 130k points