Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2016-02-11 02:37:09
Size: 365
Editor: AndrewStone
Comment:
Revision 4 as of 2016-02-12 16:02:38
Size: 915
Editor: AndrewStone
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
{{{ {{{#!highlight bash
Line 8: Line 8:
echo /usr/bin/gnome-terminal --window --command "gdb --args $0.bin $1 $2 $3 $4 $5 $6 $7 $8 $9"
/usr/bin/gnome-terminal --window --command "gdb --args $0.bin $1 $2 $3 $4 $5 $6 $7 $8 $9"
echo /usr/bin/gnome-terminal --disable-factory --window --command "gdb --args $0.bin $1 $2 $3 $4 $5 $6 $7 $8 $9"
exec /usr/bin/gnome-terminal --disable-factory --window --command "gdb --args $0.bin $1 $2 $3 $4 $5 $6 $7 $8 $9"
Line 11: Line 11:

Now when SAFplus AMF starts your program, it will pop up a terminal window and run your program inside gdb. It is important that the process id (PID) of the terminal be the same PID that SAFplus AMF started so that it can monitor your program. This is the purpose of the "exec" prefix and the --disable-factory flag. If your process forks another process and quits, the AMF will see this as a failure (your process quit, after all) and restart it. This can result in repeated restarts.

Debugging

  • Start gdb instead of your program

Rename your program 'X' to X.bin. Next create an executable script X with this content:

   1 #!/bin/bash
   2 echo /usr/bin/gnome-terminal --disable-factory --window --command "gdb --args $0.bin $1 $2 $3 $4 $5 $6 $7 $8 $9"
   3 exec /usr/bin/gnome-terminal --disable-factory --window --command "gdb --args $0.bin $1 $2 $3 $4 $5 $6 $7 $8 $9"

Now when SAFplus AMF starts your program, it will pop up a terminal window and run your program inside gdb. It is important that the process id (PID) of the terminal be the same PID that SAFplus AMF started so that it can monitor your program. This is the purpose of the "exec" prefix and the --disable-factory flag. If your process forks another process and quits, the AMF will see this as a failure (your process quit, after all) and restart it. This can result in repeated restarts.

SAFplus: SAFplus Management Developer's Guide (last edited 2017-09-18 09:07:52 by HungTa)