This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-var-update using formatted value


Hello,

I've been using varObject for a three or four months now and I noticed something weird with -var-update.
-var-update is supposed to show variables that have changed since the last -var-udpate, correct?
It does not seem to work in this case:

int main() {
    int a = 11;   // line 3
    a = 3;         // line 4
}

MI commands:
-break-insert main
-exec-run
-exec-next
-var-create - * a
-var-set-format var1 bin
-var-evaluate-expression var1
-exec-next
-var-update var1
-var-evaluate-expression var1

Session (output simplified with [...])
-break-insert main
^done,...
(gdb) 
-exec-run
^running
(gdb) 
*stopped,reason="breakpoint-hit",[...],line="3"}
(gdb) 
-exec-next
^running
(gdb) 
*stopped,reason="end-stepping-range",[...]",line="4"}
(gdb) 
-var-create - * a
^done,name="var1",numchild="0",value="11",type="int"
(gdb) 
-var-set-format var1 bin
^done,format="binary"
(gdb) 
-var-evaluate-expression var1
^done,value="1011"
(gdb) 
-exec-next
^running
(gdb) 
*stopped,reason="end-stepping-range",[...],line="5"}
(gdb) 
-var-update var1
^done,changelist=[]
(gdb) 
-var-evaluate-expression var1
^done,value="11"

As you might guess, the reason for this is that the binary value of var1 (11 in binary) when doing -var-udpate is the same as the natural value of var1 (11 in decimal)
of the previous -var-udpate (var-create in this case.)  

I believe this behaviour was introduced in version 1.75 of varobj.c in install_new_value(), where instead of comparing value contents, it now compares printed values.
I'm sure there was a good reason to compare printed values, but was this side-effect known?

Another issue with comparing printed values in -var-update is that if a front-end wants to know if a variable object memory -really- changed, it should perform
the -var-udpate using the same format every time, or else var-update will show a change although it is just the format that changed.
But maybe that is what was meant for -var-update to do?

Thanks for your input.

Marc



 
Marc Khouzam
Software Designer, Methods and Tools
 
Ericsson Canada Inc
EMC/Q
8500 Decarie Blvd.
H4P 2N2, Mont-Royal, Qc, Canada
www.ericsson.comOffice: +514 345 7900 x42350
Fax: +514 345 6159
Mobile: +514 951 7191
Email: Marc.Khouzam@ericsson.com




Ce courriel est confidentiel et uniquement destiné à son ou ses destinataires. Il est défendu de le consulter, de l'utiliser, de le dévoiler ou de le diffuser sans autorisation. Si ce message vous est parvenu par erreur, merci d'en aviser l'expéditeur par retour de courrier et de le détruire sans le divulguer.  Un courriel et ses pièces jointes peut être sans autorisation corrompu, interrompu, amendé, altéré et infecté. L'entreprise ne reçoit et n'envoie de courriel qu'avec l'entente qu'elle n'est responsable d'aucune corruption, interception, modification, altération, infection ou conséquence possible.
This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.  E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]