HP OpenVMS Systems

ask the wizard
Content starts here

Debugging Errors? From PC Address to Source Code?

» close window

The Question is:

Compiler Versions:  BASIC V1.1 through V1.5
OpenVMS  Versions:  Alpha V6 through V7.3
When a program run ends with an unexpected run time error, the line number
 listed as the source of the error almost never matches the correct line number
 of the offending code.
In over 20 years that I have used different versions of DEC/Compaq/HP Basic, I
 never had this problem under VAX VMS, but this problem always occurs under
 Alpha OpenVMS.
As a result, de-bugging programs for run-time errors takes much more time now
 under Alpha OpenVMS than previously under VAX VMS.
Is this a known problem, and is there a workaround? Or, is there something I am

The Answer is :

  The OpenVMS Wizard will assume you are refering to the application
  image's program counter line numbers; to OpenVMS virtual addresses,
  and not to the BASIC compiler's line numbers.
  To locate the failing instruction given the program counter
  (virtual) address, you will need  both the application source
  code listings from the compiler(s) involved (with the machine
  code listings enabled), and you will need the linker map.
  When provided with a failing program counter, first locate the
  failing address within the ranges listed in the linker map.
  From the linker map, you will have the source module and program
  section that contributed the failing code, and the base virtual
  address for the code.   Using the base virtual address and the
  machine code from the compiler listings, you can locate the offset
  within the routine, which will lead you to the failing instruction.
  You will want to look at use of the OpenVMS debugger, as this and
  similar tools can be used to debug the application, to locate the
  failing instructions, and even to automatically issue debugger
  commands upon program failures.
  This technique is used on both OpenVMS VAX and OpenVMS Alpha.
  For additional programming information and pointers to information
  on debugging applications, please see topics (1661) and related.

answer written or last revised on ( 3-MAY-2004 )

» close window