Hi all,
I started using gdb recently and wrote the following macros for it.
It defines macros dm, dme, and dv. Example of use:
(gdb) dm A
dm A [1.000000,-0.500000,] [1.000000,0.000000,]
Perhaps someone will find it useful. If there is a better way, please let me know, its my very first day with gdb.
Vasek
file gdb_itpp:
This file defines handy gdb macros for printing out ITPP types
To use it, add this line to your ~/.gdbinit :
source gdb_itpp
define dm
set $i=0
set $M = $arg0
set $rs = $M.no_rows
set $col = $M.no_cols
while $i < $rs
set $j=0
printf "["
while $j< $col
printf "%f,", $M.data[$j*$col+$i]
set $j++
end
printf "]"
printf "\n"
set $i++
end
end
define dme
set $i=0
set $M = $arg0
set $rs = $M.no_rows
set $col = $M.no_cols
while $i < $rs
set $j=0
printf "["
while $j< $col
printf "%e,", $M.data[$j*$col+$i]
set $j++
end
printf "]"
printf "\n"
set $i++
end
end
define dv
print $arg0.data[0]@($arg0.datasize)
end
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Adam,
in the end, I did not used "print" but "output" which has some automatic for showing different types. See feature request.
Now, the macros work even with complex numbers, though the output does not look very nice. I did not find a way how to tell gdb how to display std::complex in a better way.
Best,
Vasek
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, the not built-in type "bin" causes problems. I tried to display some bmat contents and it looked like this:
(gdb) dm cc_punct_mat [{b = 1 '\001'} ] [{b = 1 '\001'} ]
Besides, dv does not insert the line break at the end:
(gdb) dv cc_gen
{369, 491}(gdb)
I have not tested all combinations yet, but I think that the previous version (with "print") worked a little bit better.
/Adam
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I started using gdb recently and wrote the following macros for it.
It defines macros dm, dme, and dv. Example of use:
(gdb) dm A
dm A
[1.000000,-0.500000,]
[1.000000,0.000000,]
Perhaps someone will find it useful. If there is a better way, please let me know, its my very first day with gdb.
Vasek
file gdb_itpp:
This file defines handy gdb macros for printing out ITPP types
To use it, add this line to your ~/.gdbinit :
source gdb_itpp
define dm
set $i=0
set $M = $arg0
set $rs = $M.no_rows
set $col = $M.no_cols
while $i < $rs
set $j=0
printf "["
while $j< $col
printf "%f,", $M.data[$j*$col+$i]
set $j++
end
printf "]"
printf "\n"
set $i++
end
end
define dme
set $i=0
set $M = $arg0
set $rs = $M.no_rows
set $col = $M.no_cols
while $i < $rs
set $j=0
printf "["
while $j< $col
printf "%e,", $M.data[$j*$col+$i]
set $j++
end
printf "]"
printf "\n"
set $i++
end
end
define dv
print $arg0.data[0]@($arg0.datasize)
end
Hi Adam,
in the end, I did not used "print" but "output" which has some automatic for showing different types. See feature request.
Now, the macros work even with complex numbers, though the output does not look very nice. I did not find a way how to tell gdb how to display std::complex in a better way.
Best,
Vasek
Unfortunately, the not built-in type "bin" causes problems. I tried to display some bmat contents and it looked like this:
(gdb) dm cc_punct_mat
[{b = 1 '\001'} ]
[{b = 1 '\001'} ]
Besides, dv does not insert the line break at the end:
(gdb) dv cc_gen
{369, 491}(gdb)
I have not tested all combinations yet, but I think that the previous version (with "print") worked a little bit better.
/Adam
Hi,
Has anyone tested the debug mode in MSVC? How can we monitor the values of
elements of a vec (mat) variable?
Thanks in advance.