include asan with debug builds
This commit is contained in:
@@ -7,6 +7,11 @@ sources = [
|
|||||||
'src/instruction.c'
|
'src/instruction.c'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
args = ['-Wall', '-Wextra', '-O3']
|
||||||
|
if get_option('buildtype') == 'debug'
|
||||||
args = ['-Wall', '-Wextra', '-O3', '-ggdb', '-fsanitize=address']
|
args = ['-Wall', '-Wextra', '-O3', '-ggdb', '-fsanitize=address']
|
||||||
|
add_project_arguments('-fsanitize=address', language : 'c')
|
||||||
|
add_project_link_arguments('-fsanitize=address', language : 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
executable('emu', sources, c_args: args)
|
executable('emu', sources, c_args: args)
|
||||||
@@ -11,13 +11,15 @@ int main() {
|
|||||||
Instruction program[] = {
|
Instruction program[] = {
|
||||||
{INST_MVI, {REG_A, 0, 0}, 5, true},
|
{INST_MVI, {REG_A, 0, 0}, 5, true},
|
||||||
{INST_MVI, {REG_B, 0, 0}, 3, true},
|
{INST_MVI, {REG_B, 0, 0}, 3, true},
|
||||||
{INST_ADD, {REG_A, REG_B, 0}, 0, false}
|
{INST_ADD, {REG_A, REG_B, 0}, 0, false},
|
||||||
|
{INST_HLT, {}, 0, false}
|
||||||
};
|
};
|
||||||
memoryLoadProgram(emu->mem, program, sizeof(program)/sizeof(program[0]));
|
memoryLoadProgram(emu->mem, program, sizeof(program)/sizeof(program[0]));
|
||||||
|
|
||||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||||
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||||
|
printf("%s\n", instructionToCStr(decodeInstruction(emu->mem, &emu->pc)));
|
||||||
|
|
||||||
freeEmulator(emu);
|
freeEmulator(emu);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user