Attaching debugger via remote ssh

152 views
Skip to first unread message

Amneet Bhalla

unread,
Apr 27, 2015, 10:11:01 PM4/27/15
to IBAMR Developers, ibamr...@googlegroups.com
Hi Guys,

I am trying to launch an application (remotely via ssh) on two processes and attaching gdb with them. The problem is that xterm loads up slowly via ssh and the applications goes ahead without getting any gdb window attached to the processes. Those windows pop up later on, but they say could not find the uid of the application that I am launching. I have tried -debugger_pause 100 to give some time to the debugger, but the gdb windows show earlier than the application, and I get the same uid not found error. Is there a work around? I need to see the stack of both processes to debug the parallel code.

I have access to lldb locally, but I do not know how to see the stack on it, ( maybe the 'where' equivalent of gdb?) i.e., if the application is stuck on a deadlock, how to query the stack calls on lldb?

  
Thanks,
--
--Amneet 



Amneet Bhalla

unread,
Apr 28, 2015, 12:19:14 AM4/28/15
to IBAMR Developers, ibamr...@googlegroups.com
One (silly) thing that seems to be working is killing the process on lldb window and then doing up and down. Maybe there is some better solution... 

  
Thanks,
--
--Amneet 





--
--Amneet 




Boyce Griffith

unread,
Apr 28, 2015, 12:22:51 AM4/28/15
to ibamr...@googlegroups.com, IBAMR Developers
You need to bite the bullet and figure out how to use gdb on your Mac.

Did you try "-petsc_sleep n"? E.g.

mpiexec -np 2 ./main2d input2d -petsc_sleep 10 -start_in_debugger

-- Boyce


  
Thanks,
--
--Amneet 





--
--Amneet 





--
You received this message because you are subscribed to the Google Groups "IBAMR Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibamr-users...@googlegroups.com.
To post to this group, send email to ibamr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

namu patel

unread,
Apr 28, 2015, 11:38:29 AM4/28/15
to ibamr...@googlegroups.com, IBAMR Developers

You need to bite the bullet and figure out how to use gdb on your Mac.

I was able to get gdb working on my mac (OS X 10.9) using these instructions. It works,
​however,
 I never tested it with IBAMR since it requires using the g++-apple compilers (from MacPorts or Homebrew) and I didn't want to reconfigure
​ IBAMR​

Amneet Bhalla

unread,
Apr 28, 2015, 1:19:11 PM4/28/15
to IBAMR Developers, ibamr...@googlegroups.com
I had followed the same instructions. GDB (gdb-apple) works on my Mac, but only when I run the serial code in gbd and not as an xterm debugger for various processes. I get the following message, when I do something like:
%mpiexec -np 2 ./main2d input2d -start_in_debugger gdb-apple

xterm: Can't execvp gdb: No such file or directory




--
You received this message because you are subscribed to the Google Groups "IBAMR Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibamr-dev+...@googlegroups.com.
To post to this group, send email to ibam...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
--Amneet 



Amneet Bhalla

unread,
Apr 28, 2015, 1:21:35 PM4/28/15
to IBAMR Developers, ibamr...@googlegroups.com
I created a symbolic-link gdb --> gdb-apple, and now it worked. Maybe there a way to set variables in xterm properly...
--
--Amneet 



namu patel

unread,
Apr 28, 2015, 1:39:45 PM4/28/15
to ibamr-users, IBAMR Developers
On Tue, Apr 28, 2015 at 12:21 PM, Amneet Bhalla <mail2...@gmail.com> wrote:
I created a symbolic-link gdb --> gdb-apple, and now it worked. Maybe there a way to set variables in xterm properly...

This did the trick for me too, 
​t
h
anks!
 ​I don't have to run to my linux workstation to debug now.  : ) 

Boyce Griffith

unread,
Apr 28, 2015, 1:43:03 PM4/28/15
to ibamr...@googlegroups.com, IBAMR Developers
On Apr 28, 2015, at 1:18 PM, Amneet Bhalla <mail2...@gmail.com> wrote:

I had followed the same instructions. GDB (gdb-apple) works on my Mac, but only when I run the serial code in gbd and not as an xterm debugger for various processes. I get the following message, when I do something like:
%mpiexec -np 2 ./main2d input2d -start_in_debugger gdb-apple

xterm: Can't execvp gdb: No such file or directory

Sounds like an environment variable (e.g. PATH) issue.

-- Boyce





On Tue, Apr 28, 2015 at 11:37 AM, namu patel <namu....@gmail.com> wrote:

You need to bite the bullet and figure out how to use gdb on your Mac.

I was able to get gdb working on my mac (OS X 10.9) using these instructions. It works,
​however,
 I never tested it with IBAMR since it requires using the g++-apple compilers (from MacPorts or Homebrew) and I didn't want to reconfigure
​ IBAMR​


--
You received this message because you are subscribed to the Google Groups "IBAMR Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibamr-dev+...@googlegroups.com.
To post to this group, send email to ibam...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
--Amneet 




--
You received this message because you are subscribed to the Google Groups "IBAMR Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibamr-users...@googlegroups.com.
To post to this group, send email to ibamr...@googlegroups.com.

Amneet Bhalla

unread,
Apr 28, 2015, 3:39:50 PM4/28/15
to IBAMR Developers, ibamr...@googlegroups.com

On Mon, Apr 27, 2015 at 10:10 PM, Amneet Bhalla <mail2...@gmail.com> wrote:
Those windows pop up later on, but they say could not find the uid of the application that I am launching. I have tried -debugger_pause 100 to give some time to the debugger, but the gdb windows show earlier than the application, and I get the same uid not found error. Is there a work around? 

It turns out that Ubuntu was stopping the debugger to get attached to the child processes. Here is the discussion and possible fix. I am not sure if our system administrator followed the same procedure, but he agreed to the cause.





--
--Amneet 



X A

unread,
Nov 22, 2021, 5:45:37 PM11/22/21
to IBAMR Developers
Hi,

A noob question:

when I type in:
$ ./main2d input2d -start_in_debugger

I got the following:
PETSC: Attaching  to ./main2d of pid 5337 on display :0.0 on machine PC-20210823KFWO
xterm: Xt error: Can't open display: :0.0
xterm: DISPLAY is not set

and then the program just continue to run, without the chance to configure gdb debugger. (I am using WSL with Ubuntu 20.04 LTS)

I guess some configuration is not correct here. I have tried googling but did not get much clue, as it seems a command related to IBAMR.

In addition, is IBAMR compatible with more visualised debugging tools? Like Visual Studio or VS Code?

I tried visual studio, but got some error message regarding CMake.

Appreciate any comment.

With best wishes,

Mike

Boyce Griffith

unread,
Nov 22, 2021, 11:21:43 PM11/22/21
to IBAMR Developers

On Nov 22, 2021, at 3:51 AM, X A <lzk1...@gmail.com> wrote:

Hi,

A noob question:

when I type in:
$ ./main2d input2d -start_in_debugger

I got the following:
PETSC: Attaching  to ./main2d of pid 5337 on display :0.0 on machine PC-20210823KFWO
xterm: Xt error: Can't open display: :0.0
xterm: DISPLAY is not set

and then the program just continue to run, without the chance to configure gdb debugger. (I am using WSL with Ubuntu 20.04 LTS)

-start_in_debugger is a PETSc command-line option. It tries to open Xterm windows and attach gdb to each of the MPI processes. This might be relevant: https://github.com/microsoft/WSL/issues/6430.

I guess some configuration is not correct here. I have tried googling but did not get much clue, as it seems a command related to IBAMR.

In addition, is IBAMR compatible with more visualised debugging tools? Like Visual Studio or VS Code?

I think it should work, but I don’t think that any of the main developers use those tools.

I tried visual studio, but got some error message regarding CMake.

If you send the errors, we can try to see if it is a problem in the way that IBAMR’s CMake build system is set up.

Appreciate any comment.

With best wishes,

Mike

On Wednesday, 29 April 2015 at 03:39:50 UTC+8 Amneet Bhalla wrote:

On Mon, Apr 27, 2015 at 10:10 PM, Amneet Bhalla <mail2...@gmail.com> wrote:
Those windows pop up later on, but they say could not find the uid of the application that I am launching. I have tried -debugger_pause 100 to give some time to the debugger, but the gdb windows show earlier than the application, and I get the same uid not found error. Is there a work around? 

It turns out that Ubuntu was stopping the debugger to get attached to the child processes. Here is the discussion and possible fix. I am not sure if our system administrator followed the same procedure, but he agreed to the cause.





--
--Amneet 




--
You received this message because you are subscribed to the Google Groups "IBAMR Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibamr-dev+...@googlegroups.com.

X A

unread,
Nov 23, 2021, 11:17:42 AM11/23/21
to IBAMR Developers
Dear Boyce,

Many thanks for your suggestions.

I figured out that it seems convenient to run gdb debugging in the VS code + WSL with GUI. VS code seems a preferred option for me, but I still need to figure out how to make it understand all the PETSc / SAMRAI headers. It is useful that it could trace all the value changes.

If using WSL, you need to install Xming on windows to allow xterm with -start_in_debugger.

Alternatively, could also type:
gdb main2d (gdb) r input2d
to debug.

With best wishes,

Mike

Meraj Ahmed

unread,
Nov 29, 2021, 1:45:07 PM11/29/21
to ibam...@googlegroups.com
Dear all,
How to save the stress in the lagrangian geometry at different times step.

Boyce Griffith

unread,
Nov 29, 2021, 2:09:08 PM11/29/21
to IBAMR Developers


> On Nov 25, 2021, at 10:58 AM, Meraj Ahmed <meraja...@gmail.com> wrote:
>
> Dear all,
> How to save the stress in the lagrangian geometry at different times step.

It is possible to add a post processor to and IBFEMethod-based model to compute strain and stress. I don’t think there are examples of how to do this in the examples that are provided with the main code. I will create an issue to try to get one added. There is not a good way currently to export the tension in an IBMethod-based model.

By the way, please do not reply to unrelated emails to ask new questions or report new issues — it can make it harder to find information in old email threads if one is only searching by the subject line. If there is not an existing thread that is relevant, please feel free to create a new thread with a suitable subject line.
Reply all
Reply to author
Forward
0 new messages