Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble inspecting Teuchos::SerialDenseMatrix in gdb #1817

Closed
jeff788 opened this issue Oct 4, 2017 · 5 comments
Closed

Trouble inspecting Teuchos::SerialDenseMatrix in gdb #1817

jeff788 opened this issue Oct 4, 2017 · 5 comments

Comments

@jeff788
Copy link

jeff788 commented Oct 4, 2017

@trilinos/teuchos
@bartlettroscoe

Is there a good way to inspect a Teuchos::SerialDenseMatrix in gdb? I'm having an issue with an LU factorization with LAPACK on a 6x6 SerialDenseMatrix "A", and I'm trying to diagnose the problem by inspecting the input matrix. When I try to inspect any elements of the matrix this is what happens:

(gdb) p A
$30 = {Teuchos::CompObject = {
vptr.CompObject = 0x7ffff756e708 <vtable for Teuchos::SerialDenseMatrix<int, double>+16>,
flopCounter
= 0x0}, Teuchos::Object = {
vptr.Object = 0x7ffff756e730 <vtable for Teuchos::SerialDenseMatrix<int, double>+56>,
static tracebackMode = -1, label
= ""}, <Teuchos::BLAS<int, double>> = {
vptr.BLAS = 0x7ffff756e770 <vtable for Teuchos::SerialDenseMatrix<int, double>+120>},
numRows
= 6, numCols_ = 6, stride_ = 6, valuesCopied_ = true, values_ = 0x81fa9d70}
(gdb) p A(0,0)
Invalid data type for function to be called.
(gdb) p A.values()
./mesh_transfer.sh: line 2: 1692 Segmentation fault gdb /home/burg137/Projects/FY2018/NRAP/E4D/e4d_tools/MeshTransfer/bin/dream2tetgen

I also get a Segmentation fault if I try to print out the size of an ArrayRCP with ArrayRCP::size(), while I can inspect individual elements in the ArrayRCP with the [] accessor.

Thanks,

Jeff

@bartlettroscoe
Copy link
Member

@jeff788,

My personal experience with GDB is that I have not been able to use 'print any_cxx_func()` for an C++ function for many years (perhaps ever). All that I have been able to to do is print raw data. So to get the size, you will need to print the difference of the two pointers into a Teuchos::RCP, for example. Does you GDB allow you to print any C++ function?

My advice is to use a debugger that works, like TotalView or just use trusty 'std::ostream' statements in C++ code. Or just get used to debugging raw code and printing raw data. But for debugging matrices, I would just print them out in C++ and avoid the debugger until I had to use it for some reason.

Have other Teuchos or Trilinos developers had a different experience with GDB than what I described above?

@DrBooom
Copy link
Contributor

DrBooom commented Oct 5, 2017 via email

@jeff788
Copy link
Author

jeff788 commented Oct 5, 2017

I usually use gdb for pretty simple things, and have for a long time, so I guess I didn't realize how far behind these other debuggers it is. I guess I'll get myself on the learning curve. Thanks for the quick responses!

@bartlettroscoe
Copy link
Member

@jeff788, okay to close this GitHub Issue?

@jeff788 jeff788 closed this as completed Oct 5, 2017
@jeff788
Copy link
Author

jeff788 commented Oct 5, 2017

Yes, thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants