Re: Doubt using "set" command with registers

[email protected]
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Citando Pedro Alves <[email protected]>:

> Hi João,
>
> On 10/28/2014 04:01 PM, [email protected] wrote:
>> Hello all,
>>
>> I've been using GDB (in fact, conjuged with KGDB) lately to do some
>> kernel debugging. I've been testing some GDB commands, and a doubt
>> arised while using the "set" command, trying to change the value of
>> some registers. I've been able to successfully change the value of all
>> the registers provided by the "info registers" command (i. e., in my
>> case $eax, $ecx, $edx, $ebx, $esp, $ebp, $esi, $edi, $eip, $eflags,
>> $cs, $ss, $ds, $es, $fs and $gs) *except* for $esp, $ss, $fs and $gs.
>> Why is it so? I've been making these tests after hitting a hardware
>> breakpoint, then I set the values with e. g. "set $es = 0xf1c2007c",
>> and verifiy the assignemt with "info reg $es". As I've pointed out, it
>> works with the majority of the registers, except for that four (in
>> this particular case, the first command doesn't output any error, but
>> the second command shows me that the registers remain with the initial
>> value). By the way, I've started GDB with the -write option (checked
>> it inside GDb with the "show write" command). My GDB version is 7.2.
>>
>> If someone knows something about this situation and can share it with
>> me, it would be great.
>
> I'd guess that it's kgdb itself that is blocking those writes.
>
> Try "set debug remote 1" before the "set $foo = " command.
>
> Thanks,
> Pedro Alves

Hello Pedro,

Thanks for your answer. I turned "set debug remote 1" on again, and  
strangely, the output tells me that "set-register" is not supported,  
but only when I'm able to change the register value (see the output  
below). First, I've tried with a register which I can successfully  
change the value, and then with another one where I wasn't able to do  
it in the past. Do you know why this behaviour occurs? Meanwhile, I'll  
ask the same in the KGDB mailing list. Like I've mentioned, output  
below:

(gdb) info reg $es
es             0x7b	123
(gdb) set $es = 0x7c
Sending packet: $Pd=7c000000#ab...Ack
Packet received:
Packet P (set-register) is NOT supported
Sending packet:  
$G14000000ccb59cc00000000067000000089fcbf10c9fcbf1ac309dc00000000079154ac09600000060000000680000007b009dc07c000000ffff0000ffff0000#61...Ack
Packet received: OK
Sending packet: $g#67...Ack
Packet received:  
14000000ccb59cc00000000067000000089fcbf10c9fcbf1ac309dc00000000079154ac09600000060000000680000007b009dc07c000000ffff0000ffff0000
(gdb) info reg $es
es             0x7c	124
(gdb) info reg $ss
ss             0x68	104
(gdb) set $ss = 0x69
Sending packet:  
$G14000000ccb59cc00000000067000000089fcbf10c9fcbf1ac309dc00000000079154ac09600000060000000690000007b009dc07c000000ffff0000ffff0000#62...Ack
Packet received: OK
Sending packet: $g#67...Ack
Packet received:  
14000000ccb59cc00000000067000000089fcbf10c9fcbf1ac309dc00000000079154ac09600000060000000680000007b009dc07c000000ffff0000ffff0000
(gdb) info reg $ss
ss             0x68	104

Best regards,
João
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.