HiTech C v 309 - how to get cross reference and printer listing for debugging?

84 visualizações
Pular para a primeira mensagem não lida

rwd...@gmail.com

não lida,
14 de nov. de 2021, 05:34:4914/11/2021
para retro-comp
I am learning old-fashioned C and as a first step I have ported my simple hexdump program from PLI to C but am confused by the parameters for compiler operation to get a symbol file for  a debugger and a listing file of source and generated assembler code.

Can anyone assist with showing me an appropriate command line for the hi-tech c v309 compiler?

Cheers

Richard

Tony Nicholson

não lida,
14 de nov. de 2021, 20:07:3114/11/2021
para retro-comp
Richard,

On Sunday, November 14, 2021 at 9:34:49 PM UTC+11 Richard wrote:
I am learning old-fashioned C and as a first step I have ported my simple hexdump program from PLI to C but am confused by the parameters for compiler operation to get a symbol file for  a debugger and a listing file of source and generated assembler code.

Can anyone assist with showing me an appropriate command line for the hi-tech c v309 compiler?

To get a symbol file for the HI-TECH debugger (DEBUG) you'll need to link separately.

For example, you can compile with the verbose -V switch to see what the compiler does -

C>type test.c
#include <stdio.h>
main()
{
    int i, j;
    scanf("%d", &i);    /* read a decimal number from stdio */
    printf("%d\n", j);  /* echo it back */ /*Note the error - j should be i */
}

C>c -v test.c
A:C        COM
Hi-Tech C Compiler (CP/M-80) V3.09-9
Copyright (C) 1984-87 HI-TECH SOFTWARE
0:A:CPP -DCPM -DHI_TECH_C -Dz80 -I0:A: TEST.C M:$CTMP1.$$$
0:A:P1 M:$CTMP1.$$$ M:$CTMP2.$$$ M:$CTMP3.$$$
0:A:CGEN M:$CTMP2.$$$ M:$CTMP1.$$$
0:A:ZAS -N -OTESTAND.OBJ M:$CTMP1.$$$
ERA M:$CTMP1.$$$
ERA M:$CTMP2.$$$
ERA M:$CTMP3.$$$
ERA M:$CTMP5.$$$
0:A:LINQ -Z -Ptext=0,data,bss -C100H -OTESTAND.COM 0:A:CRTCPM.OBJ TESTAND.OBJ 0:A:LIBC.LIB
ERA TEST.OBJ
ERA M:$$EXEC.$$$

C>test
C:TEST     COM
123
0

C>

(on my system I have an ENVIRON file on the A: drive in user 0 that sets TMP to use drive M: - my ramdisk, so the output you see may be slightly different).  For the above program run, I typed '123' and pressed the enter key.  You can
see it has echoed the wrong variable by outputting the 0.

To get a listing you can stop the compilation after the code generation phase, use the -S switch

C>c -s test.c
A:C        COM
Hi-Tech C Compiler (CP/M-80) V3.09-9
Copyright (C) 1984-87 HI-TECH SOFTWARE

C>

Now you can assemble using ZAS and specify a listing file

C>zas -Ltest.prn test.as
A:ZAS      COM

C>

I won't include the listing TEST.PRN file output here for brevity.

Now link it together with the library routines and get a symbol file using the -d switch
(here I'm using the interactive prompting mode of the HI-TECH linker with line
continuation) -

C>linq
A:LINQ     COM
link> -d -Z -Ptext=0,data,bss -C100H -Otest.com \
link> 0:a:crtcpm.obj test.obj 0:a:libc.lib

C>

Now run the debugger (the symbol file is L.SYM)

C>debug test.com l.sym
A:DEBUG    COM
HI-TECH C DEBUGGER (Z80)
Copyright (C) 1984, 1986 HI-TECH SOFTWARE
:  

I won't go through the debugging details here - instead refer to the debugger documentation
(which has this very same example) in


It shows you how to patch the incorrect reference to the variable j.

I hope this gives you a better idea.

Tony

Richard Deane

não lida,
15 de nov. de 2021, 10:43:0215/11/2021
para Tony Nicholson, retro-comp
Thank you, I shall give that a try.

Richard

--
You received this message because you are subscribed to the Google Groups "retro-comp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to retro-comp+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/retro-comp/2138055c-0136-4ec6-af81-859c4a853430n%40googlegroups.com.
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem