How to access debug information in a running application

682 views Asked by At

I was wondering if it is possible to access debug information in a running application that has been compiled with /DEBUG (Pascal and/or C), in order to retrieve information about structures used in the application.

3

There are 3 answers

1
HABO On

The application can always ask the debugger to do something using SS$_DEBUG. If you send a list of commands that end with GO then the application will continue running after the debugger does its thing. I've used it to dump a bunch of structures formatted neatly without bothering to write the code.

ANALYZE/IMAGE can be used to examine the debugger data in the image file without running the application.

2
Hein On

Although you may not see the nice debugger information, you can always look into a running program's data with ANALYZE/SYSTEM .. SET PROCESS ... EXAMINE .... The SDA SEARCH command may come in handy to 'find' recognizable morcels of date, like a record that you know the program must have read. Also check out FORMAT/TYPE=block-type, but to make use of data you'll have to compile your structures into .STB files.

When using SDA, you may want to try run the program yourself interactively in an other session to get sample sample addresses to work from.... easier than a link map! If you programs use RMS a bunch (mine always do :-), then SDA> SHOW PROC/RMS=(FAB,RAB) may give handy addresses for record and key buffers, allthough those may also we managed by the RTL's and thus not be meaningful to you.

0
user2116290 On

Too long for a comment ...

As far as I know, structure information about elements is not in the global symbol table. What I did, on Linux, but that should work on VMS/ELF files as well:

$ cat tests.c
struct {
        int ii;
        short ss;
        float ff;
        char cc;
        double dd;
        char bb:1;
        void *pp;
} theStruct;
...
$ cc -g -c tests.c
$ ../extruct/extruct 
-e-insarg, supply an ELF object file.
Usage: ../extruct/extruct [OPTION]... elf-file variable
 Display offset and size of members of the named struct/union variable
 extracted from the dwarf info in the elf file.
 Options are:
  -b        bit offsets and bit sizes for all members
  -lLEVEL   display level for nested structures
  -n        only the member names
  -t        print base types
$ ../extruct/extruct -t ./tests.o theStruct
size of theStruct: 0x20
offset size   type name
0x0000 0x0004 int ii
0x0004 0x0002 short int ss
0x0008 0x0004 float ff
0x000c 0x0001 char cc
0x0010 0x0008 double dd
0x0018 0x0001 char bb:1
0x001c 0x0004 pp
$