diff --git a/.gitignore b/.gitignore index 0415e4d..d3957c3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ res/002-compilation-units res/003-recursion res/004-scoped-variables res/005-base-types +res/006-composite-types diff --git a/Makefile b/Makefile deleted file mode 100644 index 779c733..0000000 --- a/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -debug: - gcc main.c -g -O0 -o build/trace -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-switch # -fsanitize=address diff --git a/project.4coder b/project.4coder index 2dab6f9..bfdf018 100644 --- a/project.4coder +++ b/project.4coder @@ -30,7 +30,7 @@ command_list = { .footer_panel = false, .save_dirty_files = true, .cursor_at_end = true, - .cmd = {{ "make debug", .os = "linux" }}, + .cmd = {{ "cd src && make debug && cd ..", .os = "linux" }}, }, }; diff --git a/res/006-composite-types.c b/res/006-composite-types.c new file mode 100644 index 0000000..95247f2 --- /dev/null +++ b/res/006-composite-types.c @@ -0,0 +1,25 @@ +struct user_struct_1 { + char c_field; + // 3 bytes of padding + int int_field; + long long_field; +}; + +typedef long l64; + +int main(int argc, char **argv) +{ + int *int_ptr = (void*) 0x01; + int **int_ptr_ptr = (void *) 0x02; + + l64 long_var = 123321; + + char c = '0'; + const char *const_c = &c; + + int arr[10] = { 0 }; + + struct user_struct_1 str = { 0 }; + + return(0); +} diff --git a/res/Makefile b/res/Makefile index 3dd17a1..2f79fb7 100644 --- a/res/Makefile +++ b/res/Makefile @@ -4,3 +4,4 @@ all: gcc -g -o 003-recursion 003-recursion.c gcc -g -o 004-scoped-variables 004-scoped-variables.c gcc -g -o 005-base-types 005-base-types.c + gcc -g -o 006-composite-types 006-composite-types.c diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..c64ff5d --- /dev/null +++ b/src/Makefile @@ -0,0 +1,2 @@ +debug: + gcc main.c -g -O0 -o ../build/trace -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-switch # -fsanitize=address diff --git a/command.c b/src/command.c similarity index 100% rename from command.c rename to src/command.c diff --git a/common.h b/src/common.h similarity index 100% rename from common.h rename to src/common.h diff --git a/dwarf.c b/src/dwarf.c similarity index 100% rename from dwarf.c rename to src/dwarf.c diff --git a/eh_frame.c b/src/eh_frame.c similarity index 100% rename from eh_frame.c rename to src/eh_frame.c diff --git a/elf_dwarf.h b/src/elf_dwarf.h similarity index 100% rename from elf_dwarf.h rename to src/elf_dwarf.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/util.c b/src/util.c similarity index 100% rename from util.c rename to src/util.c