bug-gdb
[Top][All Lists]
Advanced

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

manually inserted software breakpoints in MIPS


From: Toni Ronkko
Subject: manually inserted software breakpoints in MIPS
Date: Thu, 1 Mar 2001 21:46:00 +0200 (WET)

Hi,

I tried to insert software breakpoints manually to my code in MIPS so that
I could stop GDB every time the program takes a branch I it should not
take.  Instructions "teq $0,$0" and "break 0" do the trick and the GDB
breaks on the instructions as if there were true breakpoints inserted
from the GDB interface.  However, I would like the GDB continue execution
by the continue command.  Currently it just keeps looping in the
breakpoint instruction until I force it to jump over.

The very same feature works fine on i386 if I insert "int 3"
instructions.

Toni Ronkko, <address@hidden>


Here is a full program run:

address@hidden tronkko> cat x.c
#include <stdio.h>
int main (void)
{
  asm ("teq $0,$0");
  printf ("done\n");
  return 0;
}
address@hidden tronkko> gcc -g3 x.c
address@hidden tronkko> gdb a.out 
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.2"...
(gdb) r
Starting program: /home/farke/tronkko/a.out 

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at x.c:4
4         asm ("teq $0,$0");
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at x.c:4
4         asm ("teq $0,$0");
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at x.c:4
4         asm ("teq $0,$0");
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at x.c:4
4         asm ("teq $0,$0");
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at x.c:4
4         asm ("teq $0,$0");
(gdb) stepi
4         asm ("teq $0,$0");
(gdb) 
4         asm ("teq $0,$0");
(gdb) j 5
Continuing at 0x10000fa4.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x10000fa8 in main () at x.c:5
5         printf ("done\n");
(gdb) c
Continuing.
done

Program exited normally.
(gdb) q

address@hidden tronkko> gcc --version
2.95.2
address@hidden tronkko> gdb --version
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.2".
address@hidden tronkko> uname -a
IRIX parkki 6.5 01200533 IP32 mips




reply via email to

[Prev in Thread] Current Thread [Next in Thread]