Menu

#4 printing blitz arrays via GDB

v1.0 (example)
closed
nobody
GDB (1)
5
2020-05-10
2020-05-09
CutePoison
No

Dear team BLITZ,
We are a team from Qualcomm and have been using Blitz arrays for some of the modeling problems.
We would like your inputs on a couple of queries related to blitz usage.

It is very useful that Blitz supports printing any multidimensional arrays with a very simple statement as below
std::cout<<blitz_array_name<<std::endl

We are working on a large codebase, and we would like to print the array contents during the debug sessions as well.
We use GDB for debugging. We tried an option as below

a) overloaded functions for different type of arrays which we like to print, as below
void printBlitz(blitz::Array<bool, 1=""> &in)
{
std::cout<<in<<std::endl;
}</bool,>

void printBlitz(blitz::Array<int, 1=""> &in)
{
std::cout<<in<<std::endl;
}</int,>

... and so on
on the gdb debugger, we can simply call this function as below

(gdb) call printBlitz(blitz_array_name)

The issue now is we use many types of multi-dimensional arrays (including complex), we have to make overloads for every possible array
Could you help suggest how we can overcome this by using templates in c++ for blitz types, something like below

template <typename t="">
void printBlitz(blitz::Array<<t>, 1> &in)</t></typename>

template <typename t="">
void printBlitz(blitz::Array<<t>, 2> &in)</t></typename>

or if we can template both type and array size, it is only required from a print perspective.
In parallel, we are finding out how to call c++ template functions via GDB.

Alternately, if you have any suggestions to directly print the blitz contents via GDB, please let us know.

This will simplify our debug to a large extent.
Any suggestion is highly appreciated

Thank you so much in advance !!

Discussion

  • Sylwester Arabas

    Hello!

    Note that for two years now, maintanance of Blitz++ has been carried out on Github:
    https://github.com/blitzpp/blitz/
    Please, could you repost the questions at the Blitz issue tracker there:
    https://github.com/blitzpp/blitz/issues/new

    Thanks!
    Sylwester

     
  • Sylwester Arabas

    • status: open --> closed
     

Log in to post a comment.