开发者

Using GDB to asses ASM commands

开发者 https://www.devze.com 2023-02-15 11:34 出处:网络
Im trying to write a small function to have GDB asses what a ASM command does, given 2 variables: initial value and end value.

Im trying to write a small function to have GDB asses what a ASM command does, given 2 variables: initial value and end value. Essentially im trying to get gdb to do si's until it hits a command that does what im looking for. So say for example, I am looking for the next command that adds 1 to 34. I know that I could manually go through and print out the instructions and go si, but I would rather, if its possible, create a function that looks at the ASM instruction, and then stops if it finds a command that is doing that. So assuming my command that matches is ADD R1, R2, R3 and im looking for inital value of 24 and final value of 55, if R2=24 and R3=31 and I know the command is add, that would be my que to stop. Im thinking that if I could get gdb to break apart the x/i command I could easily get it to do it, since it could separate the ADD, R1, R2, and R3 I could asses it in my own function by a if(($R2+R3)==) Problem is, I cant get GDB to break that x/i string apart.. and im thinking maybe it has to pa开发者_Go百科ss it out of GDB somehow to a external program. If anyone has any idea's im all ears.

0

精彩评论

暂无评论...
验证码 换一张
取 消