FIAS . Impressum . Privacy

debuging Vc code

Matthias Kretz [please enable javascript to see the address]
Fri Aug 20 16:37:17 CEST 2010


On Friday 20 August 2010 16:17:21 you wrote:
> Can you tell me, please, how do you debug code, which uses Vc?
> gdb gives me something unreadable when I try to print short_v, float_v
> variables... And it doesn't let to use operator[]()

normally I debug at the assembler level. In gdb it is very useful to enter the 
command "layout asm". Then you need to identify the memory locations or the 
xmm register which holds your variable. For xmm registers you can simply use 
"p $xmm0" for memory locations you have to use casts and manual calculation of 
the correct addresses.

Attached you can find a script I use with gdb (just put it in your $HOME dir). 
You can do e.g. "pvf <address>" to print a float_v at a given memory address.

Cheers,
	Matthias

PS: Please use the mailinglist for these kinds of questions. I'm sure you're 
not the only one to have this question.

-- 
Dipl.-Phys. Matthias Kretz
-------------- next part --------------
source $HOME/kde-devel-gdb

define pvd
        set $a = (double*)$arg0
        printf "[%f, %f]\n", $a[0], $a[1]
end

define pvf
        set $a = (float*)$arg0
        printf "["
        set $i = 0
        while $i < 3
                printf "%f, ", $a[$i]
                set $i = $i + 1
        end
        printf "%f]\n", $a[$i]
end

define pvi
        set $a = (int*)$arg0
        printf "["
        set $i = 0
        while $i < 3
                printf "%d, ", $a[$i]
                set $i = $i + 1
        end
        printf "%d]\n", $a[$i]
end

define pvui
        set $a = (unsigned int*)$arg0
        printf "["
        set $i = 0
        while $i < 3
                printf "%d, ", $a[$i]
                set $i = $i + 1
        end
        printf "%d]\n", $a[$i]
end

define pvs
        set $a = (short*)$arg0
        printf "["
        set $i = 0
        while $i < 7
                printf "%d, ", $a[$i]
                set $i = $i + 1
        end
        printf "%d]\n", $a[$i]
end

define pvus
        set $a = (unsigned short*)$arg0
        printf "["
        set $i = 0
        while $i < 7
                printf "%d, ", $a[$i]
                set $i = $i + 1
        end
        printf "%d]\n", $a[$i]
end


More information about the Vc mailing list
FIAS . Impressum . Privacy