BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
314 stars 39 forks source link

Support memory attributes for sections defined in assembler-files #91

Closed leifo closed 2 years ago

leifo commented 2 years ago

I'd like to define chip-section on the asm-side for convenience reasons for copperlists and bitplanes. I have already mixed this toolchain with vasm which can output ELF, generally works like a charm, but then cannot support memory attributes without the help of a patched linker (as far as I understand now after a message from phx), as the ELF-format does not support that.

Something like 'section chipram,data_c'. (I don't care for my sections names as long as they go to the right type of memory).

'section " .INCBIN.MEMF_CHIP ",data_c' (inspired by defines in gcc8_c_support.h) get's close but chokes the vscode-GDB connection with this error message: "Failed to launch GDB: TypeError: Cannot set property 'address' of undefined".

Could this be done?

BartmanAbyss commented 2 years ago

The section name according to gcc8_c_support.h should work. Got a minimal repro case for me? I‘ll have a look.

leifo commented 2 years ago

Here is a test project: https://github.com/leifo/amiga-demolib/tree/master/gcc-vasm-sections (green screen if working, or only chip available, otherwise blue)

BartmanAbyss commented 2 years ago

The problem was just the extraneous spaces around the section name section ".INCBIN.MEMF_CHIP",data_c works fine.

Here are all supported section name suffixes from elf2hunk:

if(strcmp(nameext, ".MEMF_CHIP") == 0) {
    hh[i]->memflags |= MEMF_CHIP;
} else if(strcmp(nameext, ".MEMF_LOCAL") == 0) {
    hh[i]->memflags |= MEMF_LOCAL;
} else if(strcmp(nameext, ".MEMF_KICK") == 0) {
    hh[i]->memflags |= MEMF_KICK;
} else if(strcmp(nameext, ".MEMF_FAST") == 0) {
    hh[i]->memflags |= MEMF_FAST;
}