Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mod04 debuggers

498 views

Published on

Application Migration to HP NonStop H- und J-Series Operating Systems

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Mod04 debuggers

  1. 1. DebuggersDebuggersModule 4
  2. 2. Available DebuggersAvailable Debuggers◦ Visual Inspect Preferred for most uses Default if Inspect attribute on◦ Native Inspect (eInspect) TNS/E programs only Extensible through tcl scripts Default if no others available◦ Inspect TNS and Screen COBOL programs only TNS saveabend files◦ Debug is not available on TNS/E4 - Debuggers 2
  3. 3. Debugger SelectionDebugger Selection4 - Debuggers 3TNS/EProcessVisualInspectInspectNativeInspectNativeInspectINSPECT ON INSPECT OFFVISUALINSPECTUNAVAILABLEINSPECTONINSPECT OFFTNSProcessVisualInspect
  4. 4. Visual InspectVisual Inspect TNS/E,TNS programs◦ Basic TNS/E support , for example:watch items, breakpoints, resume◦ Better switching to/from system debugger (eInspect)◦ Creating/modifying/formatting register watch items◦ Formatting EMS/SPI buffers as watch items◦ Displaying/modifying/monitoring/formattingarbitrary memory◦ Providing multi-byte support◦ Supporting efficient conditional data breakpoints◦ Stepping instructions and statements◦ Displaying source statements and corresponding instructions4 - Debuggers 4
  5. 5. Visual Inspect (1 of 5)Visual Inspect (1 of 5)4 - Debuggers 5ExecutionModeIndicatorStep Instruction andStep In Instruction
  6. 6. Visual Inspect (2 of 5)Visual Inspect (2 of 5)6
  7. 7. Visual Inspect (3 of 5)Visual Inspect (3 of 5)4 - Debuggers 7
  8. 8. Visual Inspect (4 of 5)Visual Inspect (4 of 5)84 - Debuggers
  9. 9. Visual Inspect (5 of 5)Visual Inspect (5 of 5)4 - Debuggers 9
  10. 10. Native InspectNative Inspect◦ Based on GDB (Open Source)/WDB (HP version)◦ UNIX-style commands for example: fopen <filenum> –d◦ Inspect  Native Inspect commands: source  list obey  source break  break resume  continue step  next step in  step step out  finish clear  delete display  print modify  set add program  snapshot4 - Debuggers 10
  11. 11. Native Inspect — FeaturesNative Inspect — Features◦ Automatically displays next source statement “source on” equivalent◦ Automatically displays function arguments Value if data item Address if pointer◦ Automatically displays return values from functions When function is “finished” Including void functions◦ Breakpoint display shows number of times triggered◦ Supports TCL scripts4 - Debuggers 11
  12. 12. Starting Native InspectStarting Native Inspect◦ Starting the process: Guardian: RUND or RUNV OSS: run –debug or runv◦ Running process DEBUG $xyz◦ Programmatically PROCESS_DEBUG_() DEBUG()◦ Customization file: EINSCSTM executed during start-up Note: In all of the cases above, Visual Inspect will be theactivated debugger if the Inspect attribute is on and theVisual Inspect client is running.4 - Debuggers 12
  13. 13. Native Inspect - HelpNative Inspect - Help help [<topic>](eInspect 2,372):helpNative Inspect helpThe following are major topics from which you canchoose:all -- List all Native Inspect commands.help -- Help on helpsource -- Source in a Tcl script file.target process -- Commands that support processdebugging.target snapshot -- Commands that support snapshotanalysis.Type "help" followed by the keyword of the topic orNative Inspect command you want to browse.4 - Debuggers 13
  14. 14. Native Inspect – BreakpointsNative Inspect – Breakpoints◦ Setting: break {function | paragraph | [source-file:]line#} [if cond-exp](eInspect 2,372):break get_second_numberBreakpoint 2 at 0x70000ba0:1: file DAGGER.$DATA00.TERRYG.CALLC,line 6.(eInspect 2,372):b callc:8 if second_number== 99Breakpoint 3 at 0x70000bf0:1: file DAGGER.$DATA00.TERRYG.CALLC,line 8.◦ Displaying: info break(eInspect 2,372):info bNum Type Disp Enb Glb Address What2 breakpoint keep y n 0x70000ba1 in get_second_numberat DAGGER.$DATA00.TERRYG.CALLC:6 breakpoint already hit 1 time3 breakpoint keep y n 0x70000bf1 in get_second_numberat DAGGER.$DATA00.TERRYG.CALLC:8 stop only if second_number == 99◦ Clearing: delete [breakpoint#] - Deletes all breakpoints if no number given4 - Debuggers 14
  15. 15. Native Inspect – Execution ControlNative Inspect – Execution Control◦ Execute until breakpoint: Continue: (eInspect 2,372):cContinuing.Breakpoint 2, get_second_number (first_number=12,total=0x6fffff44) at DAGGER.$DATA00.TERRYG.CALLC:6* 6 printf ("ENTER THE SECOND NUMBER: ");◦ Execute next statement (including calledfunction) Next: (eInspect 2,372):nmain () at DAGGER.$DATA00.TERRYG.MAINC:16* 16 while (req_run_status == 0)4 - Debuggers 15
  16. 16. Native Inspect – Execution ControlNative Inspect – Execution Control◦ Execute to a specified location: until function | paragraph | [source-file:]line#◦ Execute the remainder of a function (stop onreturn to calling function): fin[ish](eInspect 2,372):finishRun till exit from #0 get_second_number (first_number=12,total=0x6fffff44)at DAGGER.$DATA00.TERRYG.CALLC:6ENTER THE SECOND NUMBER: 34THE NUMBERS ENTERED WERE: 12 & 340x70000af0:0 in main () at DAGGER.$DATA00.TERRYG.MAINC:24* 24 get_second_number (first_number, &total);Value returned is $1 = 344 - Debuggers 16
  17. 17. Commands at a BreakpointCommands at a Breakpoint◦ Execute commands at a breakpoint(eInspect 2,372):info bNum Type Disp Enb Glb Address What2 breakpoint keep y n 0x70000ba1 inget_second_number at DAGGER.$DATA00.TERRYG.CALLC:6(eInspect 2,372):commands 2Type commands for when breakpoint 2 is hit, one per line.End with a line saying just "end".>print first_number>print *total>end(eInspect 2,372):c - Continuing.Breakpoint 2, get_second_number (first_number=12,total=0x6fffff44)at DAGGER.$DATA00.TERRYG.CALLC:6* 6 printf ("ENTER THE SECOND NUMBER: ");$1 = 12$2 = 04 - Debuggers 17
  18. 18. Native Inspect – Data DisplayNative Inspect – Data Display◦ Local variables orWorking Storage info locals(eInspect 2,372):info localsreq_run_status = 0first_number = 12total = 46(eInspect 0,779):info localsREQ-RUN-STATUS = 0warning: Invalid or Uninitialized zoned decimal value: FIRST-NUMBER = 000◦ Other variables print [/format-letter] <variable-name > | <condition-name> format-letter is o(octal), x(hex), d(decimal), u(unsigned decimal),t(binary), f(float), a(address), i(instruction), c(char) and s(string).(eInspect 2,372):p total$2 = 46(eInspect 2,372):p /x total$3 = 0x2e4 - Debuggers 18
  19. 19. Native Inspect – Data DisplayNative Inspect – Data Display◦ Arrays print <array-name>@<n> set print elements <n> (default is 200)◦ Pointers (C)(eInspect 2,372):p total$4 = (short *) 0x6fffff44(eInspect 2,372):p *total$5 = 46◦ Pointers (pTAL)(eInspect 1,494):p total$3 = (INT *) 0x6fffff54(eInspect 1,494):p .totalA syntax error in expression, near `total.(eInspect 1,494):p *total$4 = 464 - Debuggers 19
  20. 20. Native Inspect –Variable Information DisplayNative Inspect –Variable Information Display◦ Data type whatis <variable-name>(eInspect 2,372):whatis totaltype = short *(eInspect 1,494):whatis totaltype = INT *(eInspect 0,779):whatis totaltype = PIC S99994 - Debuggers 20
  21. 21. Native Inspect – Data ModificationNative Inspect – Data Modification◦ Modifying variable or pointer set [variable] <variable-name>=<new-value>(eInspect 2,372):set *total=9994 - Debuggers 21
  22. 22. Native Inspect – Source Statements DisplayNative Inspect – Source Statements Display◦ list [ [<source-file>:]line#| [<source-file>:]function ]eInspect 2,372):l15 display_initial_req_message ();16 while (req_run_status == 0)17 {18 printf ("ENTER FIRST NUMBER [or 0 to stop]: ");19 scanf ("%hi", &first_number);* 20 if (first_number == 0)21 req_run_status = 1;22 else23 {24 get_second_number (first_number, &total);(eInspect 2,372):l25 printf ("THE TOTAL IS: %hin", total);26 }27 } /* end while */28 } /* end main */4 - Debuggers 22
  23. 23. Native Inspect – Source FilesNative Inspect – Source Files◦ Display source file names(eInspect 3,450):info sourcesSource files for which symbols have been read in:DAGGER.$DATA00.TERRYG.MAINCSource files for which symbols will be read in on demand:ATOM.$RLSE.T8432ABN.VERSNMNC, SPEEDY.$RLSE.T8432H02.CPLMAINC,DAGGER.$DATA00.TERRYG.CALLC◦ Find source files dir <new-subvolume> | <new-directory>Breakpoint 1 at 0x70000a20:0: file DAGGER.$DATA00.TERRYG.MAINC,line 11.(eInspect 1,559):lDAGGER.$DATA00.TERRYG.MAINC: No such file or directory.(eInspect 1,559):dir $data00.tgtestSource directories searched: $data00.tgtest:$cdir:$cwd(eInspect 1,559):list2 short get_second_number (short, short *);3 void display_initial_req_message (void)4 { printf ("YOU HAVE JUST STARTED THE ...4 - Debuggers 23
  24. 24. Native Inspect – Function Names (C)Native Inspect – Function Names (C)◦ info functions [<wildcard-string>](eInspect 12,372):info functionsAll defined functions:File ATOM.$RLSE.T8432ABN.VERSNMNC:void T8432H02_21MAY2008_CCPLMAIN();File SPEEDY.$RLSE.T8432H02.CPLMAINC:void _MAIN();void __INIT__1_C();File DAGGER.$DATA00.TERRYG.CALLC:short get_second_number(short, short *);File DAGGER.$DATA00.TERRYG.MAINC:void display_initial_req_message();int main();Non-debugging symbols:0x700008e0 .plt4 - Debuggers 24
  25. 25. Native Inspect – Function Names (pTAL)Native Inspect – Function Names (pTAL)(eInspect 1,494):info functionsAll defined functions:File DAGGER.$DATA00.TERRYG.CALLP:void GET_SECOND_NUMBER(INT, INT *);File DAGGER.$DATA00.TERRYG.MAINP:void DISPLAY_INITIAL_REQ_MESSAGE();void MAIN_PROG();Non-debugging symbols:0x700007c0 .pltCurrent language: auto; currently ptal4 - Debuggers 25
  26. 26. Native Inspect – Program Names (COBOL)Native Inspect – Program Names (COBOL)(eInspect 0,779):info functionsAll defined functions:File DAGGER.$DATA00.TERRYG.CALLCOB:GET-SECOND-NUMBER PROGRAM-UNIT;File DAGGER.$DATA00.TERRYG.MAINCOB:CALCULATOR PROGRAM-UNIT;Non-debugging symbols:0x70000a00 .plt0x70004780 __INIT__0_CALCULATOR_0x70004900 __INIT__1_CALCULATOR_Current language: auto; currently COBOL4 - Debuggers 26
  27. 27. Native Inspect – Open File InformationNative Inspect – Open File Information fopen [<filenum> [-d] ](eInspect 2,372):fopenFileNum LastErr Name1 0 DAGGER.$ZTN0.#PTWNEAK(eInspect 2,372):fopen 1 -dName DAGGER.$ZTN0.#PTWNEAKFilenum 1General File Information.Device Type 0Device Subtype 30Object Type -1Logical Device Number -1Open Access 0Open Exclusion 0Open Nowait Depth 0Open Sync Depth 1Open Options 0Physical Record Length 132 BytesOutstanding Requests 0Error 0Error Detail 04 - Debuggers 27
  28. 28. Native Inspect – Open File InformationNative Inspect – Open File Information (eInspect 0,779):fopen FileNum LastErr Name 1 0 / 3 0 /G/data00/terryg (eInspect 0,779):fopen 3 -d Name /G/data00/terryg Filenum 3 OSS File Information. Mode 16384 Error 0 Error Detail 04 - Debuggers 28
  29. 29. Native Inspect – Stack CommandsNative Inspect – Stack Commands◦ Stack tracebacktrace | bt(eInspect 1,559):bt#0 get_second_number (first_number=12, total=0x6fffff44)at DAGGER.$DATA00.TERRYG.CALLC:6#1 0x70000af0:0 in main () at DAGGER.$DATA00.TERRYG.MAINC:24#2 0x70000e00:0 in _MAIN () at SPEEDY.$RLSE.T8432H02.CPLMAINC:46(eInspect 2,557):bt#0 GET_SECOND_NUMBER (FIRST_NUMBER=12, TOTAL=0x6fffff54)at DAGGER.$DATA00.TERRYG.CALLP:16#1 0x70001250:0 in MAIN_PROG () at DAGGER.$DATA00.TERRYG.MAINP:77(eInspect 3,457):bt#0 GET-SECOND-NUMBER (FIRST-NUMBER=0x8001220, TOTAL=0x8001228)at DAGGER.$DATA00.TERRYG.CALLCOB:22#1 0x70003460:0 in CALCULATOR () at DAGGER.$DATA00.TERRYG.MAINCOB:504 - Debuggers 29
  30. 30. Miscellaneous CommandsMiscellaneous Commands◦ Change to a different debugger switch ChangesTNS/E process toVisual Inspect ChangesTNS process to Inspect◦ Create a snapshot/saveabend file save <filename[!]>◦ Open a snapshot/saveabend file snapshot <filename>4 - Debuggers 30
  31. 31. Miscellaneous CommandsMiscellaneous Commands◦ Print allows function calls print <expression>(eInspect 1,919):l1 int adder (int a, int b)2 { return a + b; }3 int main (void)4 {* 5 printf("Sample program.n");6 }(eInspect 1,919):print adder(14, 15)$1 = 294 - Debuggers 31
  32. 32. Native Inspect —TNS ProcessNative Inspect —TNS Process◦ Limited commands: continue — Resume execution kill — Terminate process bt — Stack trace save — Create snapshot file switch — Switch to different debugger4 - Debuggers 32
  33. 33. Questions ?Questions ?33
  34. 34. 4 - Debuggers 34

×