From 084b2c5e371411a465b3517d0afc2bebf931d2ba Mon Sep 17 00:00:00 2001 From: Peter Gerwinski <peter.gerwinski@hs-bochum.de> Date: Wed, 28 Sep 2022 07:58:00 +0200 Subject: [PATCH] Nachbereitung 9.12.2021 --- 20211209/crash-0.c | 1 + 20211209/crash-1.c | 7 +++++++ 20211209/crash-2.c | 9 +++++++++ 20211209/crash-3.c | 13 +++++++++++++ 20211209/crash-4.c | 18 ++++++++++++++++++ 20211209/crash-5.c | 19 +++++++++++++++++++ 20211209/crash-6.c | 23 +++++++++++++++++++++++ 20211209/es-20211209.txt | 8 ++++++++ 8 files changed, 98 insertions(+) create mode 100644 20211209/crash-0.c create mode 100644 20211209/crash-1.c create mode 100644 20211209/crash-2.c create mode 100644 20211209/crash-3.c create mode 100644 20211209/crash-4.c create mode 100644 20211209/crash-5.c create mode 100644 20211209/crash-6.c create mode 100644 20211209/es-20211209.txt diff --git a/20211209/crash-0.c b/20211209/crash-0.c new file mode 100644 index 0000000..62d2245 --- /dev/null +++ b/20211209/crash-0.c @@ -0,0 +1 @@ +main(){puts(0);} diff --git a/20211209/crash-1.c b/20211209/crash-1.c new file mode 100644 index 0000000..d4f8b19 --- /dev/null +++ b/20211209/crash-1.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main (void) +{ + printf (42); + return 0; +} diff --git a/20211209/crash-2.c b/20211209/crash-2.c new file mode 100644 index 0000000..c0d5c0f --- /dev/null +++ b/20211209/crash-2.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int main (void) +{ + printf ("Vor printf()\n"); + printf (42); + printf ("Nach printf()\n"); + return 0; +} diff --git a/20211209/crash-3.c b/20211209/crash-3.c new file mode 100644 index 0000000..570685e --- /dev/null +++ b/20211209/crash-3.c @@ -0,0 +1,13 @@ +#include <stdio.h> + +void print_answer (int answer) +{ + printf ("Die Antwort lautet: "); + printf (answer); +} + +int main (void) +{ + print_answer (42); + return 0; +} diff --git a/20211209/crash-4.c b/20211209/crash-4.c new file mode 100644 index 0000000..76ed93c --- /dev/null +++ b/20211209/crash-4.c @@ -0,0 +1,18 @@ +#include <stdio.h> + +void print_answer (int answer) +{ + if (answer < 256) + { + printf ("Die Antwort lautet: "); + printf (answer); + } + else + printf ("Die Antwort ist zu kompliziert."); +} + +int main (void) +{ + print_answer (42); + return 0; +} diff --git a/20211209/crash-5.c b/20211209/crash-5.c new file mode 100644 index 0000000..00e06ed --- /dev/null +++ b/20211209/crash-5.c @@ -0,0 +1,19 @@ +#include <stdio.h> + +void print_answer (int answer) +{ + if (answer == 42) + { + printf ("Die Antwort lautet: "); + printf (answer); + } + else + printf ("Die Antwort ist zu kompliziert.\n"); +} + +int main (void) +{ + for (int a = 0; a < 1000; a++) + print_answer (a); + return 0; +} diff --git a/20211209/crash-6.c b/20211209/crash-6.c new file mode 100644 index 0000000..5f14383 --- /dev/null +++ b/20211209/crash-6.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +int s = 0; + +void print_answer (int answer) +{ + s += answer; + if (answer == 42) + { + printf ("Die Antwort lautet: "); + printf (answer); + } + else + printf ("Die Antwort ist zu kompliziert.\n"); +} + +int main (void) +{ + for (int a = 0; a < 1000; a++) + print_answer (a); + printf ("Die Summe der Antworten lautet: %d\n", s); + return 0; +} diff --git a/20211209/es-20211209.txt b/20211209/es-20211209.txt new file mode 100644 index 0000000..9971aaf --- /dev/null +++ b/20211209/es-20211209.txt @@ -0,0 +1,8 @@ +GNU-Debugger, 09.12.2021, 15:45:26 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + - Original-Dokumentation: + https://www.sourceware.org/gdb/documentation/ + + - Tutorial: + https://www.tutorialspoint.com/gnu_debugger/ + oder: Web-Suche nach: "gdb" "tutorial" -- GitLab