TCC: join two dirs into one

git-svn-id: svn://kolibrios.org@7849 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
2020-04-30 09:59:56 +00:00
parent 60c6638d09
commit b364fe71e3
31 changed files with 5 additions and 3379 deletions
@@ -0,0 +1,27 @@
1. create asm listing:
compile .o only, then use objdump
kos32-tcc.exe -c -g clipview.c -o clipviewtcc.o
kos32-objdump -d -M intel -S -l clipviewtcc.o > clipviewtcc.asm
2. see offset in resulting kolibri executable compared to listing (i have 0xD0)
3. in kolibri debugger mtdbg set breakpoint to funtion address
>bp 140
where 0x140 is 0x70 in assemly + offset 0xD0
Warning !!Error. sometimes tcc dont warn about unsuccesful linking
(not found function body code). Hopefully, i fix this.
Usually, at runtime you have crash with "Illegal cpu instruction"
In assembler code this is easy to recognize as
myaddr:E8 FC FF FF FF call myaddr+1
4.how to see defines
kos32-tcc.exe -E -dD null
5.if you use GNU LD as a linker, add option -Map=hellocpp.map to ld.
Mtdbg can use resulting .map file
6.now you can use -g option to generate .dbg file. This enables
source code level debugging with Mtdbg
Binary file not shown.
Binary file not shown.
@@ -1,43 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int i;
char c;
FILE *f;
FILE *fin;
FILE *fout;
//write to file
f=fopen("testfile.txt","w");
for(i=0;i<50;i++)
{
fputc('1',f);
}
fclose(f);
//append to file
f=fopen("testfile.txt","a");
for(i=0;i<50;i++)
{
fputc('2',f);
}
fclose(f);
//copy from testfile.txt to copyfile.txt
fin=fopen("testfile.txt","r");
fout=fopen("copyfile.txt","w");
while((c=fgetc(fin))!=EOF)
{
fputc(c,fout);
}
fclose(fin);
fclose(fout);
}