blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
402 stars 83 forks source link

printing blitz arrays via GDB #164

Open kishore1947 opened 4 years ago

kishore1947 commented 4 years ago

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;
}

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

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

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 !!

citibeth commented 4 years ago

Would the use of templates address your problem?

On Sun, May 10, 2020 at 03:53 kishore1947 notifications@github.com wrote:

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; }

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

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

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 !!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOVY56MPVLFLFFVJHFMSLTRQZMQNANCNFSM4M5EIRRA .

-- Elizabeth Fischer, she/her University of Alaska, Geophysical Institute cell: 617-308-0436

UA is an AA/EO employer and educational institution and prohibits illegal discrimination against any individual: www.alaska.edu/nondiscrimination.

kishore1947 commented 4 years ago

Hi, Thanks a lot for the response ! I tried doing this but no luck, also it is not very straight forward to call template functions via GDB, but is still ok. Could you please help provide an example with the same code as I gave, by writing a template function to print a blitz array

Thanks a lot !

Thanks and Best Regards, Kishore

On Sun, May 10, 2020 at 2:05 PM Elizabeth Fischer notifications@github.com wrote:

Would the use of templates address your problem?

On Sun, May 10, 2020 at 03:53 kishore1947 notifications@github.com wrote:

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; }

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

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

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 !!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/164, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAOVY56MPVLFLFFVJHFMSLTRQZMQNANCNFSM4M5EIRRA

.

-- Elizabeth Fischer, she/her University of Alaska, Geophysical Institute cell: 617-308-0436

UA is an AA/EO employer and educational institution and prohibits illegal discrimination against any individual: www.alaska.edu/nondiscrimination.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/blitzpp/blitz/issues/164#issuecomment-626292944, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPMQNHOAXR4LRNDKNSJUMTRQZROXANCNFSM4M5EIRRA .

-- What lies behind you and what lies before you are tiny compared to what lies within you !

slayoo commented 4 years ago

Perhaps some points from this discussion might be relevant: https://github.com/blitzpp/blitz/issues/43