This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remote Debugging problem


Hi all,

I have a gdb stub,running on my target.
I am able to connect to the target through TCP and debug 
my app from the host.

My Problem is 
1. I get a SIGTRAP received message for every function call,
   even if I am not stepping into the function or have not set a breakpoint
in
   the function.
   I get the SRC_AND_LOC message always,when ideally I should only the
  the SRC_LINE displayed.
  eg: When I step through a function foo() in function xyz() I get

      xyx () at xyz.c:78
        
2. Also when a breakpoint is hit ,The don't get the Breakpoint number 
   displayed.
   I get the SRC_AND_LOC displayed,but no breakpoint info.

What could be the problem.
I am using gdb 6.0 configured for i386-elf on cygwin

Could anything be possibily wrong with my gdb stub,which is
derived from the basic gdb stub.

Below is the code that  am trying to debug....
To be specific my problem is that I get a SIGTRAP message after evry
function call...
In the log below i get a SIGTRAP after the call to function hello()
Also if I set the breakpoint to hello(),I don't get the message that
BreakPoint 2 is hit...
Thanks
Kiran
==============================================================

int x = 0;
int y = 9;

int a,b,c;

int main(void)
{

	real_main();
	while (1)
	{
	}
}

int real_main(void)
{
	int tim_id = 1;
	int iSerialId;
	char acBuff[2] = {0};
	int iRetVal;



	int i = 0;

	
	hello ();

	for (i=0; i<10; i++)
	{

		hello ();
		y=100;
		x = 100;
	}

	


	return 0;
}


int __main(void) { return 0; }

void _alloca(void) { }


void
hello ()
{

	DbgPrintf ("Hello World from App = %x\r\n",main);

}
=============================================================

Breakpoint 1 at 0x9f0044: file app.c, line 15.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at app.c:15
15              real_main();
(gdb) s

Program received signal SIGTRAP, Trace/breakpoint trap.
real_main () at app.c:23
23              int tim_id = 1;
(gdb) n
25              char acBuff[2] = {0};
(gdb) n
30              int i = 0;
(gdb) n
33              hello ();
(gdb) n

Program received signal SIGTRAP, Trace/breakpoint trap.
real_main () at app.c:35
35              for (i=0; i<10; i++)
(gdb) n
38                      hello ();
(gdb) set debug remote 1
(gdb) n
Sending packet: $Z0,9f0044,1#7a...Ack
Packet received: OK
Sending packet: $s#73...Ack
Packet received: T054:78ffc000;5:94ffc000;8:af009f00;
Sending packet: $m9f00af,1#90...Ack
Packet received: 55
Sending packet: $m9f00af,1#90...Ack
Packet received: 55
Sending packet: $mc0ff78,4#9b...Ack
Packet received: 7e009f00
Sending packet: $Z0,9f007e,1#ae...Ack
Packet received: OK
Sending packet: $c#63...Ack
Packet received: T054:7cffc000;5:94ffc000;8:7e009f00;

Program received signal SIGTRAP, Trace/breakpoint trap.
Sending packet: $z0,9f007e,1#ce...Ack
Packet received: OK
Sending packet: $z0,9f0044,1#9a...Ack
Packet received: OK
real_main () at app.c:39
39                      y=100;
(gdb) set debug remote 0
(gdb) disassemble
Dump of assembler code for function real_main:
0x009f004b <real_main+0>:       push   %ebp
0x009f004c <real_main+1>:       mov    %esp,%ebp
0x009f004e <real_main+3>:       sub    $0x18,%esp
0x009f0051 <real_main+6>:       movl   $0x1,0xfffffffc(%ebp)
0x009f0058 <real_main+13>:      movw   $0x0,0xfffffff6(%ebp)
0x009f005e <real_main+19>:      movl   $0x0,0xffffffec(%ebp)
0x009f0065 <real_main+26>:      call   0x9f00af <hello>
0x009f006a <real_main+31>:      movl   $0x0,0xffffffec(%ebp)
0x009f0071 <real_main+38>:      cmpl   $0x9,0xffffffec(%ebp)
0x009f0075 <real_main+42>:      jle    0x9f0079 <real_main+46>
0x009f0077 <real_main+44>:      jmp    0x9f0099 <real_main+78>
0x009f0079 <real_main+46>:      call   0x9f00af <hello>
0x009f007e <real_main+51>:      movl   $0x64,0x9f00ec
0x009f0088 <real_main+61>:      movl   $0x64,0x9f00e8
0x009f0092 <real_main+71>:      lea    0xffffffec(%ebp),%eax
0x009f0095 <real_main+74>:      incl   (%eax)
0x009f0097 <real_main+76>:      jmp    0x9f0071 <real_main+38>
0x009f0099 <real_main+78>:      mov    $0x0,%eax
0x009f009e <real_main+83>:      leave
0x009f009f <real_main+84>:      ret
End of assembler dump.
(gdb) b hello
Breakpoint 2 at 0x9f00b5: file app.c, line 59.
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
hello () at app.c:59
59              PsimPrintf ("Hello World from App = %x\r\n",main);
(gdb) set debug remote 1
(gdb) c
Continuing.
Sending packet: $Hc0#db...Ack
Packet received:
Sending packet: $s#73...Ack
Packet received: T054:64ffc000;5:74ffc000;8:b8009f00;
Sending packet: $Z0,9f0044,1#7a...Ack
Packet received: OK
Sending packet: $Z0,9f00b5,1#a9...Ack
Packet received: OK
Sending packet: $Hc0#db...Ack
Packet received:
Sending packet: $c#63...Ack
Packet received: T054:6cffc000;5:74ffc000;8:b5009f00;

Program received signal SIGTRAP, Trace/breakpoint trap.
Sending packet: $z0,9f0044,1#9a...Ack
Packet received: OK
Sending packet: $z0,9f00b5,1#c9...Ack
Packet received: OK
hello () at app.c:59
59              PsimPrintf ("Hello World from App = %x\r\n",main);
(gdb) set debug remote 0
(gdb) disassemble
Dump of assembler code for function hello:
0x009f00af <hello+0>:   push   %ebp
0x009f00b0 <hello+1>:   mov    %esp,%ebp
0x009f00b2 <hello+3>:   sub    $0x8,%esp
0x009f00b5 <hello+6>:   sub    $0x8,%esp
0x009f00b8 <hello+9>:   push   $0x9f0034
0x009f00bd <hello+14>:  push   $0x9f00cc
0x009f00c2 <hello+19>:  call   0x401fa0
0x009f00c7 <hello+24>:  add    $0x10,%esp
0x009f00ca <hello+27>:  leave
0x009f00cb <hello+28>:  ret
End of assembler dump.
(gdb)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]