NjmonForAIXDebugging

Debugging AIX:

Note: njmon in debug mode CAN NOT be used with the njmon Collector or the njmon Injector

These are the steps

  1. Place the njmon binary and matching (same version) source code file (.c) in a directory
  2. When in that directory start the AIX debugger naming the binary
  3. Execute the program with the dbx "run" command as follows: run -d -s 1 -c 100 >output.json
  4. If/When it crashes use the dbx where command to locate the line of the code that hit the issue.
  5. Return for diagnoses all the screen output or at least the last page and the contents of the "output.json" file to Nigel
  6. To get out of the debugger use: quit

Below I added code to cause a crash due to a Segmentation fault (writing to an uninitialised pointer) - of course, your symptoms will be different.

$ dbx njmon
Type 'help' for help.
reading symbolic information ...
(dbx) run -d -s 1 -c 100 >output.json
. . .
. . .
ps_fc_stats called line 1354
filesystems called line 2514
ps_lv_stats called line 2607
ps_vg_stats called line 2690
ps_tape called line 2240
dr_lpar_stats called line 3188
gpfs_data called line 960
ERROR: njmon version 19@14/02/2019
ERROR: Assert Failure in file="njmon_aix_v19.c" in function="main" at line=3894
ERROR: Reason=CRASHer
ERROR: value=0
ERROR: Expression=[[loop == 42]]
ERROR: errno=2
ERROR: errno means : No such file or directory

Segmentation fault in njmon_aix_v19.assert at line 539 ($t1)
  539                   *c = 42;
(dbx)
(dbx) where
njmon_aix_v19.assert(file = "ASSERT CHECK: %s %s %d %s %s %d %ld\n", function = "njmon_aix_v19.c", line = 536873912,
 expression = "", reason = "loop == 42", next = 536876632, flag = 3, value = 0, ptr = (nil)), line 539 in "njmon_aix_v19.c"
main(argc = 0, argv = (nil)), line 3894 in "njmon_aix_v19.c.
(dbx) quit