mult/mflo strange result when using psp-gdb

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
hrimfaxi
Posts: 20
Joined: Thu Nov 23, 2006 5:40 pm

mult/mflo strange result when using psp-gdb

Post by hrimfaxi »

Hi, folks. When I use psp-gdb to debug my application, something weird happened:

Code: Select all

int a = 1024;
int b = 768;
int c = a * b;
If I use gdb next instruction on "int c = a * b", it will get a very strage result: c = 64 ...

The disassemble version of the code is :

Code: Select all

li $v0, 0x400
li $v1, 0x300
mult $v0, $v1
mflo $v0
If I use gdb si instruction on these instruction, I will also get the same result.

If I don't use gdb, run this code directly, I will get the corrent result 786432.

I am using psp-gcc 4.3.2 and psp-gdb 6.8 from the latest psptoolchain SVN trunk.

TODO: I will get some more deatils on this bug.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Ahum, looks like the is a bug in psplink's exception handler :) It never restores the lo/hi registers so stepping over the instructions trashes the values and you get crap back. Try checking out the latest psplinkusb and updating your psplink.prx file.
hrimfaxi
Posts: 20
Joined: Thu Nov 23, 2006 5:40 pm

Post by hrimfaxi »

Thanks, I updated the latest psplinkusb and it works fine now.
Post Reply