ddd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying flags


From: Zarko Zivanov
Subject: Displaying flags
Date: Wed, 8 Sep 2004 14:02:41 +0200

If there is anyone interested, here is one solution to displaying
individual flags in eflags register with their names. This was done
and tested with ddd 3.3.9 and gdb 6.0 on a x86 platform under Mandrake
Linux 10.0.

First, create a new ddd theme named flags.vsl (put it in .ddd/themes
in your home directory) with this content:

------------------cut here -------------------
// Flags
ends_in(s1, s2) = 
    let s1c = chars(s1), 
        s2c = chars(s2) in suffix(s2c, s1c);

new_name(name) = (if (ends_in(name,"1) != 0")) then
                        "carry"
                elsif (ends_in(name,"64) != 0")) then
                        "zero"
                elsif (ends_in(name,"28) != 0")) then
                        "sign"
                elsif (ends_in(name,"24) != 0")) then
                        "direction"
                elsif (ends_in(name,"48) != 0")) then
                        "overflow"
                else
                        name
                fi);

#pragma override old_title
old_title(name) -> title(name);
old_title(disp_nr, name) -> title(disp_nr, name);

#pragma override title
title (disp_nr, name) -> old_title(disp_nr, name)
        where name = new_name(name);
        
title (name) -> old_title(name)
        where name = new_name(name);
------------------cut here -------------------

Next, start ddd, select Data/Themes and add
        ($eflags*
as a pattern for flags theme. Enable theme, and type, for example
($eflags & 1) != 0
in argument line and display it. Voila! You have a box with title
'carry' and value of carry flag.

You can also define buttons for flags (be sure to turn off
'Enable supported buttons only' option), or just add this to
Ddd*dataButtons section in .ddd/init in your home directory:

------------------cut here -------------------
graph display ($eflags & 1) != 0 // carry\n\
graph display ($eflags & 64) != 0 // zero\n\
graph display ($eflags & 128) != 0 // sign\n\
graph display ($eflags & 1024) != 0 // direction\n\
graph display ($eflags & 2048) != 0 // overflow
Ddd*verifyButtons: off
------------------cut here -------------------

This is maybe a dirty solution, but if someone has a cleaner solution
to this, please let me know.

Best regards,
Zarko

P.S. And, PLEASE, is there a way to protect this list from spam? 







reply via email to

[Prev in Thread] Current Thread [Next in Thread]