This is cause gdb puts software breakpoints as follows: 1.Fill up the memory with some predefined pattern (0x0000) od word length 2. Advance a counter by word length to jump over the filled bytes and remembers a counter value. 3. Save replaced code.
When it hits a zero word , the simulator issues a signal - "interrupted with a reason breakpoint". When this signal issued, the real counter (PC) will be pointing the end of zeros. Then if finds a real code at saved address and restores memory. Stop execution and revert a counter backward by 2. So, nothing wrong is here... There might be worse situation when local vars or params are not displaied correctly. And I do not really know how to fix it. ~d On Friday 11 October 2002 06:54, Galen Seitz wrote: > I have been using the simulator under gdb, and I've encountered an odd > problem when trying to set a breakpoint at 'main' under gdb. The > breakpoint gets set at main+2. I suspect I am making a dumb mistake, > but I can't figure it out. > > Here is the code, > > .global main > main: > mov #0x1234,r4 > jmp main > > > and the build, > > msp430-gcc -mmcu=msp430x1101 -Wa,--gstabs -D_GNU_ASSEMBLER_ -c -o > bkpt_test.o bkpt_test.S > msp430-gcc -mmcu=msp430x1101 -o bkpt_test bkpt_test.o > msp430-objcopy -O ihex bkpt_test bkpt_test.ihx > msp430-objdump -DS bkpt_test >bkpt_test.lst > > > and the gdb session. > > bash$ msp430-gdb bkpt_test > GNU gdb 5.1.1 > Copyright 2002 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 "--host=i686-pc-linux-gnu --target=msp430"... > (gdb) p/x &main > $1 = 0xfc40 > (gdb) b main > Breakpoint 1 at 0xfc42: file bkpt_test.S, line 4. > (gdb) > > > Why is the breakpoint being set at 0xfc42 instead of 0xfc40? > > thanks, > galen > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mspgcc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mspgcc-users -- /******************************************************************** ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ `6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys (_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44 _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia (il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314 ********************************************************************/
