Last login: Wed Sep 28 22:19:34 on ttys003 cd/Users/ericperez/.zshrc:export:18: not valid in this context: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home (base) ericperez@MacBook-Pro-de-Eric-2 ~ % cd Desktop (base) ericperez@MacBook-Pro-de-Eric-2 Desktop % gcc -g -o prog prog.c clang: error: no such file or directory: 'prog.c' clang: error: no input files (base) ericperez@MacBook-Pro-de-Eric-2 Desktop % gdb ./prog GNU gdb (GDB) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin20.6.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./prog... Reading symbols from /Users/ericperez/Desktop/prog.dSYM/Contents/Resources/DWARF/prog... (gdb) run Starting program: /Users/ericperez/Desktop/prog [New Thread 0x1f03 of process 1158] [New Thread 0x1903 of process 1158] [New Thread 0x1c03 of process 1158] warning: unhandled dyld version (17) Khoor#zruog1 Thread 3 received signal SIGSEGV, Segmentation fault. 0x0000000100003ef7 in affiche (message=0x0) at prog.c:7 warning: Source file is more recent than executable. 7 printf("%c", (*message)+i); (gdb) c Continuing. Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. (gdb) c The program is not being run. (gdb) run Starting program: /Users/ericperez/Desktop/prog [New Thread 0x1f13 of process 1160] [New Thread 0x1a03 of process 1160] [New Thread 0x2a03 of process 1160] warning: unhandled dyld version (17) Khoor#zruog1 Thread 3 received signal SIGSEGV, Segmentation fault. 0x0000000100003ef7 in affiche (message=0x0) at prog.c:7 7 printf("%c", (*message)+i); (gdb) backtrace #0 0x0000000100003ef7 in affiche (message=0x0) at prog.c:7 #1 0x0000000100003f74 in main () at prog.c:18 (gdb) c Continuing. Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. (gdb) break main Breakpoint 1 at 0x100003f4f: file prog.c, line 15. (gdb) run Starting program: /Users/ericperez/Desktop/prog [New Thread 0x1f23 of process 1163] [New Thread 0x2c03 of process 1163] [New Thread 0x5403 of process 1163] warning: unhandled dyld version (17) Thread 3 hit Breakpoint 1, main () at prog.c:15 15 char * mess1 = NULL; (gdb) next 16 char * mess2 = "Hello world."; (gdb) print mess1 $1 = 0x0 (gdb) next 17 affiche(mess2); (gdb) next Khoor#zruog1 18 affiche(mess1); (gdb) step affiche (message=0x0) at prog.c:5 5 int i = 3; (gdb) step 7 printf("%c", (*message)+i); (gdb) step Thread 3 received signal SIGSEGV, Segmentation fault. 0x0000000100003ef7 in affiche (message=0x0) at prog.c:7 7 printf("%c", (*message)+i); (gdb) print (*message)+i Cannot access memory at address 0x0 (gdb)