# HG changeset patch # User ichikitakahiro # Date 1614503331 -32400 # Node ID 81cf42d178591360f1330fbf1d818f6896ad2c42 # Parent 3d4b02ddac9f885d4c672f14834e90c014ce9f16 add log diff -r 3d4b02ddac9f -r 81cf42d17859 log28pm.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/log28pm.txt Sun Feb 28 18:08:51 2021 +0900 @@ -0,0 +1,507 @@ +ichikitakahiro % vim test4.c +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test4.c +zsh: command not found: -Wall +ichikitakahiro % pwd +/Users/ichikitakahiro/workspace/cr/CbC_log +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test4.c +zsh: command not found: -Wall +ichikitakahiro % . ~/.zshrc +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test4.c +test4.c: In function 'CG1': +test4.c:8:8: error: too few arguments to function 'codes[i + 1]' + 8 | goto codes[i+1](); + | ^~~~~ +test4.c:8:20: error: expected code segment jump or '*' before ';' token + 8 | goto codes[i+1](); + | ^ +test4.c: In function 'CG2': +test4.c:13:8: error: too few arguments to function 'codes[i + 1]' + 13 | goto codes[i+1](); + | ^~~~~ +test4.c:13:20: error: expected code segment jump or '*' before ';' token + 13 | goto codes[i+1](); + | ^ +test4.c: In function 'main': +test4.c:23:8: error: too few arguments to function 'codes[0]' + 23 | goto codes[0](); + | ^~~~~ +test4.c:23:18: error: expected code segment jump or '*' before ';' token + 23 | goto codes[0](); + | ^ +ichikitakahiro % vim test4.c +ichikitakahiro % vim test4.c +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test4.c +ichikitakahiro % ./a.out +CG1 +CG2 +CG3 +ichikitakahiro % vim test4.c +ichikitakahiro % pwd +/Users/ichikitakahiro/workspace/cr/CbC_log +ichikitakahiro % ls +CbC_history.txt a.out a.out.dSYM test4.c +ichikitakahiro % lldb a.out +(lldb) target create "a.out" +bCurrent executable set to 'a.out' (x86_64). +(lldb) b main +Breakpoint 1: where = a.out`main + 4 at test4.c:20:12, address = 0x0000000100000e90 +(lldb) process la +Process 77501 launched: '/Users/ichikitakahiro/workspace/cr/CbC_log/a.out' (x86_64) +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 + frame #0: 0x0000000100000e90 a.out`main at test4.c:20:12 + 17 } + 18 + 19 int main(){ +-> 20 codes[0] = CG1; + 21 codes[1] = CG2; + 22 codes[2] = CG3; + 23 goto codes[0](0); +Target 0: (a.out) stopped. +(lldb) nn +error: 'nn' is not a valid command. +(lldb) n +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000e9e a.out`main at test4.c:21:12 + 18 + 19 int main(){ + 20 codes[0] = CG1; +-> 21 codes[1] = CG2; + 22 codes[2] = CG3; + 23 goto codes[0](0); + 24 } +Target 0: (a.out) stopped. +(lldb) n +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000eac a.out`main at test4.c:22:12 + 19 int main(){ + 20 codes[0] = CG1; + 21 codes[1] = CG2; +-> 22 codes[2] = CG3; + 23 goto codes[0](0); + 24 } +Target 0: (a.out) stopped. +(lldb) p CG1 +(void (*)(int)) $0 = 0x0000000100000df8 (a.out`CG1 at test4.c:6:18) +(lldb) p codes +(void (*[3])(int)) $1 = { + [0] = 0x0000000100000df8 (a.out`CG1 at test4.c:6:18) + [1] = 0x0000000100000e35 (a.out`CG2 at test4.c:11:18) + [2] = 0x0000000000000000 +} +(lldb) x/20i codes[0] + 0x100000df8: 55 pushq %rbp + 0x100000df9: 48 89 e5 movq %rsp, %rbp + 0x100000dfc: 48 83 ec 10 subq $0x10, %rsp + 0x100000e00: 89 7d fc movl %edi, -0x4(%rbp) + 0x100000e03: 48 8d 3d f0 00 00 00 leaq 0xf0(%rip), %rdi ; "CG1" + 0x100000e0a: e8 cb 00 00 00 callq 0x100000eda ; symbol stub for: puts + 0x100000e0f: 8b 45 fc movl -0x4(%rbp), %eax + 0x100000e12: 83 c0 01 addl $0x1, %eax + 0x100000e15: 48 98 cltq + 0x100000e17: 48 8d 14 c5 00 00 00 00 leaq (,%rax,8), %rdx + 0x100000e1f: 48 8d 05 ea 11 00 00 leaq 0x11ea(%rip), %rax ; codes + 0x100000e26: 48 8b 14 02 movq (%rdx,%rax), %rdx + 0x100000e2a: 8b 45 fc movl -0x4(%rbp), %eax + 0x100000e2d: 83 c0 01 addl $0x1, %eax + 0x100000e30: 89 c7 movl %eax, %edi + 0x100000e32: c9 leave + 0x100000e33: ff e2 jmpq *%rdx + 0x100000e35: 55 pushq %rbp + 0x100000e36: 48 89 e5 movq %rsp, %rbp + 0x100000e39: 48 83 ec 10 subq $0x10, %rsp +(lldb) n +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000eba a.out`main at test4.c:23:13 + 20 codes[0] = CG1; + 21 codes[1] = CG2; + 22 codes[2] = CG3; +-> 23 goto codes[0](0); + 24 } +Target 0: (a.out) stopped. +(lldb) s +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000e03 a.out`CG1(i=0) at test4.c:7:3 + 4 __code (*codes[3])(int); + 5 + 6 __code CG1(int i){ +-> 7 printf("CG1\n"); + 8 goto codes[i+1](i+1); + 9 } + 10 +Target 0: (a.out) stopped. +(lldb) n +CG1 +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000e0f a.out`CG1(i=0) at test4.c:8:15 + 5 + 6 __code CG1(int i){ + 7 printf("CG1\n"); +-> 8 goto codes[i+1](i+1); + 9 } + 10 + 11 __code CG2(int i){ +Target 0: (a.out) stopped. +(lldb) s +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000e32 a.out`CG1(i=0) at test4.c:9:1 + 6 __code CG1(int i){ + 7 printf("CG1\n"); + 8 goto codes[i+1](i+1); +-> 9 } + 10 + 11 __code CG2(int i){ + 12 printf("CG2\n"); +Target 0: (a.out) stopped. +(lldb) +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000e33 a.out`CG1(i=0) at test4.c:8:8 + 5 + 6 __code CG1(int i){ + 7 printf("CG1\n"); +-> 8 goto codes[i+1](i+1); + 9 } + 10 + 11 __code CG2(int i){ +Target 0: (a.out) stopped. +(lldb) s +Process 77501 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000e35 a.out`CG2(i=0) at test4.c:11:18 + 8 goto codes[i+1](i+1); + 9 } + 10 +-> 11 __code CG2(int i){ + 12 printf("CG2\n"); + 13 goto codes[i+1](i+1); + 14 } +Target 0: (a.out) stopped. +(lldb) l + 15 __code CG3(int i){ + 16 printf("CG3\n"); + 17 } + 18 + 19 int main(){ + 20 codes[0] = CG1; + 21 codes[1] = CG2; +(lldb) l + 22 codes[2] = CG3; + 23 goto codes[0](0); + 24 } +(lldb) l 1 + 1 #include + 2 #include + 3 + 4 __code (*codes[3])(int); + 5 + 6 __code CG1(int i){ + 7 printf("CG1\n"); + 8 goto codes[i+1](i+1); + 9 } + 10 +(lldb) l + 11 __code CG2(int i){ + 12 printf("CG2\n"); + 13 goto codes[i+1](i+1); + 14 } + 15 __code CG3(int i){ + 16 printf("CG3\n"); + 17 } + 18 + 19 int main(){ + 20 codes[0] = CG1; +(lldb) l + 21 codes[1] = CG2; + 22 codes[2] = CG3; + 23 goto codes[0](0); + 24 } +(lldb) exit +Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y +ichikitakahiro % pwd +/Users/ichikitakahiro/workspace/cr/CbC_log +ichikitakahiro % cd .. +ichikitakahiro % ls +CbC CbC_log Singularity test_space +ichikitakahiro % pwd +/Users/ichikitakahiro/workspace/cr +ichikitakahiro % cd .. +ichikitakahiro % +ichikitakahiro % cd ~/src/firefly/hg/Gears +ichikitakahiro % ls +Gears +ichikitakahiro % cd Gears +ichikitakahiro % ls +Dockerfile doc src +ichikitakahiro % cd src/parallel_execution +ichikitakahiro % ls +Atomic.h LockImpl.cbc Stack.h generate_context.pl +AtomicReference.cbc MCTaskManagerImpl.cbc SynchronizedQueue.cbc generate_stub.pl +AtomicT.h MCTaskManagerImpl.h TaskIterator.cbc helper_cuda.h +AtomicTImpl.cbc ModelChecking TaskManager.h helper_string.h +AtomicTImpl.h MultiDimIterator.cbc TaskManagerImpl.cbc impl +Buffer.h Queue.h Timer.h interface +CMakeLists.txt RedBlackTree.agda TimerImpl.cbc lib +CPUWorker.cbc RedBlackTree.cbc Todo perlTests +CUDAExecutor.cbc RedBlackTreeReWright.cbc Tree.h plautogen +CUDAWorker.cbc Semaphore.h Worker.h stack.agda +CodeGear.h SemaphoreImpl.cbc cleanup.sh test +Executor.h SingleLinkedQueue.cbc compare.c tmp_tool +Iterator.h SingleLinkedStack.cbc cuda.c tools +Lock.h SpinLock.cbc examples verifier +ichikitakahiro % +ichikitakahiro % cmake . +CMake Warning (dev) in CMakeLists.txt: + No project() command is present. The top-level CMakeLists.txt file must + contain a literal, direct call to the project() command. Add a line of + code such as + + project(ProjectName) + + near the top of the file, but after cmake_minimum_required(). + + CMake is pretending there is a "project(Project)" command on the first + line. +This warning is for project developers. Use -Wno-dev to suppress it. + +-- The C compiler identification is AppleClang 11.0.0.11000033 +-- The CXX compiler identification is AppleClang 11.0.0.11000033 +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped +-- Detecting C compile features +-- Detecting C compile features - done +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Configuring done +-- Generating done +-- Build files have been written to: /Users/ichikitakahiro/src/firefly/hg/Gears/Gears/src/parallel_execution +ichikitakahiro % ls -ltr +total 960 +-rw-r--r-- 1 ichikitakahiro staff 309 2 12 18:13 Atomic.h +-rw-r--r-- 1 ichikitakahiro staff 642 2 12 18:13 AtomicReference.cbc +-rw-r--r-- 1 ichikitakahiro staff 238 2 12 18:13 AtomicT.h +-rw-r--r-- 1 ichikitakahiro staff 916 2 12 18:13 AtomicTImpl.cbc +-rw-r--r-- 1 ichikitakahiro staff 103 2 12 18:13 AtomicTImpl.h +-rw-r--r-- 1 ichikitakahiro staff 251 2 12 18:13 Buffer.h +-rw-r--r-- 1 ichikitakahiro staff 6746 2 12 18:13 CMakeLists.txt +-rw-r--r-- 1 ichikitakahiro staff 4696 2 12 18:13 CPUWorker.cbc +-rw-r--r-- 1 ichikitakahiro staff 4805 2 12 18:13 CUDAExecutor.cbc +-rw-r--r-- 1 ichikitakahiro staff 5132 2 12 18:13 CUDAWorker.cbc +-rw-r--r-- 1 ichikitakahiro staff 357 2 12 18:13 CodeGear.h +-rw-r--r-- 1 ichikitakahiro staff 333 2 12 18:13 Executor.h +-rw-r--r-- 1 ichikitakahiro staff 366 2 12 18:13 Iterator.h +-rw-r--r-- 1 ichikitakahiro staff 193 2 12 18:13 Lock.h +-rw-r--r-- 1 ichikitakahiro staff 2893 2 12 18:13 LockImpl.cbc +-rw-r--r-- 1 ichikitakahiro staff 9200 2 12 18:13 MCTaskManagerImpl.cbc +-rw-r--r-- 1 ichikitakahiro staff 538 2 12 18:13 MCTaskManagerImpl.h +drwxr-xr-x 13 ichikitakahiro staff 416 2 12 18:13 ModelChecking +-rw-r--r-- 1 ichikitakahiro staff 3331 2 12 18:13 MultiDimIterator.cbc +-rw-r--r-- 1 ichikitakahiro staff 336 2 12 18:13 Queue.h +-rw-r--r-- 1 ichikitakahiro staff 7889 2 12 18:13 RedBlackTree.agda +-rw-r--r-- 1 ichikitakahiro staff 17767 2 12 18:13 RedBlackTree.cbc +-rw-r--r-- 1 ichikitakahiro staff 9303 2 12 18:13 RedBlackTreeReWright.cbc +-rw-r--r-- 1 ichikitakahiro staff 206 2 12 18:13 Semaphore.h +-rw-r--r-- 1 ichikitakahiro staff 1315 2 12 18:13 SemaphoreImpl.cbc +-rw-r--r-- 1 ichikitakahiro staff 2521 2 12 18:13 SingleLinkedQueue.cbc +-rw-r--r-- 1 ichikitakahiro staff 2326 2 12 18:13 SingleLinkedStack.cbc +-rw-r--r-- 1 ichikitakahiro staff 1002 2 12 18:13 SpinLock.cbc +-rw-r--r-- 1 ichikitakahiro staff 605 2 12 18:13 Stack.h +-rw-r--r-- 1 ichikitakahiro staff 3701 2 12 18:13 SynchronizedQueue.cbc +-rw-r--r-- 1 ichikitakahiro staff 1056 2 12 18:13 TaskIterator.cbc +-rw-r--r-- 1 ichikitakahiro staff 535 2 12 18:13 TaskManager.h +-rw-r--r-- 1 ichikitakahiro staff 8385 2 12 18:13 TaskManagerImpl.cbc +-rw-r--r-- 1 ichikitakahiro staff 191 2 12 18:13 Timer.h +-rw-r--r-- 1 ichikitakahiro staff 758 2 12 18:13 TimerImpl.cbc +-rw-r--r-- 1 ichikitakahiro staff 5668 2 12 18:13 Todo +-rw-r--r-- 1 ichikitakahiro staff 362 2 12 18:13 Tree.h +-rw-r--r-- 1 ichikitakahiro staff 285 2 12 18:13 Worker.h +-rwxr-xr-x 1 ichikitakahiro staff 218 2 12 18:13 cleanup.sh +-rw-r--r-- 1 ichikitakahiro staff 274 2 12 18:13 compare.c +-rw-r--r-- 1 ichikitakahiro staff 2348 2 12 18:13 cuda.c +drwxr-xr-x 13 ichikitakahiro staff 416 2 12 18:13 examples +-rw-r--r-- 1 ichikitakahiro staff 18841 2 12 18:13 generate_context.pl +-rw-r--r-- 1 ichikitakahiro staff 57387 2 12 18:13 generate_stub.pl +-rw-r--r-- 1 ichikitakahiro staff 31897 2 12 18:13 helper_cuda.h +-rw-r--r-- 1 ichikitakahiro staff 6048 2 12 18:13 helper_string.h +drwxr-xr-x 3 ichikitakahiro staff 96 2 12 18:13 impl +drwxr-xr-x 3 ichikitakahiro staff 96 2 12 18:13 interface +drwxr-xr-x 3 ichikitakahiro staff 96 2 12 18:13 lib +drwxr-xr-x 9 ichikitakahiro staff 288 2 12 18:13 perlTests +drwxr-xr-x 4 ichikitakahiro staff 128 2 12 18:13 plautogen +-rw-r--r-- 1 ichikitakahiro staff 10583 2 12 18:13 stack.agda +drwxr-xr-x 8 ichikitakahiro staff 256 2 12 18:13 test +drwxr-xr-x 3 ichikitakahiro staff 96 2 12 18:13 tmp_tool +drwxr-xr-x 6 ichikitakahiro staff 192 2 12 18:13 tools +drwxr-xr-x 5 ichikitakahiro staff 160 2 12 18:13 verifier +-rw-r--r-- 1 ichikitakahiro staff 14368 2 28 14:56 CMakeCache.txt +-rw-r--r-- 1 ichikitakahiro staff 104591 2 28 14:56 Makefile +-rw-r--r-- 1 ichikitakahiro staff 1651 2 28 14:56 cmake_install.cmake +drwxr-xr-x 25 ichikitakahiro staff 800 2 28 14:56 CMakeFiles +ichikitakahiro % vim CMakeLists.txt +ichikitakahiro % ./cleanup.sh +ichikitakahiro % pwd +/Users/ichikitakahiro/src/firefly/hg/Gears/Gears/src/parallel_execution +ichikitakahiro % cd .. +ichikitakahiro % ls +CMakeLists.txt include llrb parallel_execution test +ichikitakahiro % cd parallel_execution +ichikitakahiro % ls examples/ +DPP DPPMC boundedBuffer generics_test pop_and_push twice +DPP2 bitonicSort calc piposaru sandbox +ichikitakahiro % mkdir examples/wc/ +ichikitakahiro % vim !$/main.cbc +vim examples/wc//main.cbc +ichikitakahiro % vim examples/pop_and_push/StackTestImpl.cbc +ichikitakahiro % cat Queue.h +typedef struct Queue<>{ + __code whenEmpty(...); + __code clear(Impl* queue, __code next(...)); + __code put(Impl* queue, union Data* data, __code next(...)); + __code take(Impl* queue, __code next(union Data* data, ...)); + __code isEmpty(Impl* queue, __code next(...), __code whenEmpty(...)); + __code next(...); +} Queue; +ichikitakahiro % find . -name Queue +ichikitakahiro % find . -name *Queue* +find: SingleLinkedQueue.cbc: unknown primary or operator +ichikitakahiro % find . -name /*Queue +zsh: no matches found: /*Queue +ichikitakahiro % find . -name \*Queue.h +./plautogen/impl/SingleLinkedQueue.h +./plautogen/impl/SynchronizedQueue.h +./Queue.h +ichikitakahiro % vim SynchronizedQueue.cbc +ichikitakahiro % vim examples/twice/main.cbc +ichikitakahiro % cp examples/twice/main.cbc examples/wc/main.cbc +ichikitakahiro % vim examples/wc/main.cbc +ichikitakahiro % make DPP2 +CMake Warning (dev) in CMakeLists.txt: + No project() command is present. The top-level CMakeLists.txt file must + contain a literal, direct call to the project() command. Add a line of + code such as + + project(ProjectName) + + near the top of the file, but after cmake_minimum_required(). + + CMake is pretending there is a "project(Project)" command on the first + line. +This warning is for project developers. Use -Wno-dev to suppress it. + +-- The C compiler identification is AppleClang 11.0.0.11000033 +-- The CXX compiler identification is AppleClang 11.0.0.11000033 +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped +-- Detecting C compile features +-- Detecting C compile features - done +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Configuring done +-- Generating done +-- Build files have been written to: /Users/ichikitakahiro/src/firefly/hg/Gears/Gears/src/parallel_execution +[ 11%] Generating c/examples/DPP2/main.c +[ 11%] Generating c/AtomicReference.c +[ 22%] Generating c/CPUWorker.c +[ 22%] Generating c/TaskManagerImpl.c +[ 22%] Generating c/SynchronizedQueue.c +[ 33%] Generating c/examples/DPP2/AtomicTImpl.c +[ 33%] Generating c/SingleLinkedStack.c +[WARN] Not found SingleLinkedStack.h at generate_stub.pl line 674. +[ 33%] Generating c/examples/DPP2/PhilsImpl.c +[ 33%] Generating c/examples/DPP2/ForkImpl.c +[ 44%] Generating c/DPP2-context.c +Scanning dependencies of target DPP2 +[ 44%] Building C object CMakeFiles/DPP2.dir/c/TaskManagerImpl.c.o +[ 55%] Building C object CMakeFiles/DPP2.dir/c/CPUWorker.c.o +[ 55%] Building C object CMakeFiles/DPP2.dir/c/SynchronizedQueue.c.o +[ 55%] Building C object CMakeFiles/DPP2.dir/c/examples/DPP2/AtomicTImpl.c.o +[ 66%] Building C object CMakeFiles/DPP2.dir/c/SingleLinkedStack.c.o +[ 66%] Building C object CMakeFiles/DPP2.dir/c/examples/DPP2/PhilsImpl.c.o +[ 77%] Building C object CMakeFiles/DPP2.dir/c/examples/DPP2/main.c.o +[ 77%] Building C object CMakeFiles/DPP2.dir/c/examples/DPP2/ForkImpl.c.o +[ 77%] Building C object CMakeFiles/DPP2.dir/ModelChecking/crc32.c.o +[ 88%] Building C object CMakeFiles/DPP2.dir/ModelChecking/memory.c.o +[ 88%] Building C object CMakeFiles/DPP2.dir/ModelChecking/state_db.c.o +[ 88%] Building C object CMakeFiles/DPP2.dir/c/AtomicReference.c.o +[100%] Building C object CMakeFiles/DPP2.dir/c/DPP2-context.c.o +[100%] Linking C executable DPP2 +[100%] Built target DPP2 +ichikitakahiro % vim context.h +ichikitakahiro % vim examples/wc/wcTarget.h +ichikitakahiro % vim examples/wc/main.cbc +ichikitakahiro % vim examples/DPP2/main.cbc +ichikitakahiro % vim examples/wc/main.cbc +ichikitakahiro % pwd +/Users/ichikitakahiro/src/firefly/hg/Gears/Gears/src/parallel_execution +ichikitakahiro % hg states +hg: unknown command 'states' +(did you mean one of debugstate, status?) +ichikitakahiro % +ichikitakahiro % hg status +? src/parallel_execution/.SingleLinkedQueue.cbc.swo +? src/parallel_execution/examples/wc/Wc.h +? src/parallel_execution/examples/wc/WcImpl.cbc +? src/parallel_execution/examples/wc/WcImpl.h +? src/parallel_execution/examples/wc/WcResult.h +? src/parallel_execution/examples/wc/main.cbc +? src/parallel_execution/examples/wc/wcTarget.h +? src/parallel_execution/temp.cbc +ichikitakahiro % hg add examples/wc/ +adding examples/wc/Wc.h +adding examples/wc/WcImpl.cbc +adding examples/wc/WcImpl.h +adding examples/wc/WcResult.h +adding examples/wc/main.cbc +adding examples/wc/wcTarget.h +ichikitakahiro % hg status +A src/parallel_execution/examples/wc/Wc.h +A src/parallel_execution/examples/wc/WcImpl.cbc +A src/parallel_execution/examples/wc/WcImpl.h +A src/parallel_execution/examples/wc/WcResult.h +A src/parallel_execution/examples/wc/main.cbc +A src/parallel_execution/examples/wc/wcTarget.h +? src/parallel_execution/.SingleLinkedQueue.cbc.swo +? src/parallel_execution/temp.cbc +ichikitakahiro % hg commit -m "add wc Example" +ichikitakahiro % hg push +pushing to ssh://firefly/hg/Gears/Gears +searching for changes +remote has heads on branch 'default' that are not known locally: a5b36ecbb86e +abort: push creates new remote head faa9afc7dd07 +(pull and merge or see 'hg help push' for details about pushing new heads) +ichikitakahiro % hg pull +pulling from ssh://firefly/hg/Gears/Gears +searching for changes +adding changesets +adding manifests +adding file changes +added 1 changesets with 5 changes to 5 files (+1 heads) +new changesets a5b36ecbb86e +(run 'hg heads' to see heads, 'hg merge' to merge) +ichikitakahiro % hg merge +5 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +ichikitakahiro % hg commit +ichikitakahiro % hg push +pushing to ssh://firefly/hg/Gears/Gears +searching for changes +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 2 changesets with 6 changes to 6 files +ichikitakahiro % + diff -r 3d4b02ddac9f -r 81cf42d17859 log28pm_impl.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/log28pm_impl.txt Sun Feb 28 18:08:51 2021 +0900 @@ -0,0 +1,195 @@ +Last login: Sun Feb 28 14:06:53 on ttys002 +ichikitakahiro % cd !$ +cd '$@' +cd: no such file or directory: $@ +ichikitakahiro % cd ~/src/firefly/hg/Gears/Gears/src/parallel_execution/ +ichikitakahiro % vim examples/pop_and_push/main.cbc +ichikitakahiro % ls +Atomic.h Queue.h compare.c +AtomicReference.cbc RedBlackTree.agda cuda.c +AtomicT.h RedBlackTree.cbc examples +AtomicTImpl.cbc RedBlackTreeReWright.cbc generate_context.pl +AtomicTImpl.h Semaphore.h generate_stub.pl +Buffer.h SemaphoreImpl.cbc helper_cuda.h +CMakeLists.txt SingleLinkedQueue.cbc helper_string.h +CPUWorker.cbc SingleLinkedStack.cbc impl +CUDAExecutor.cbc SpinLock.cbc interface +CUDAWorker.cbc Stack.h lib +CodeGear.h SynchronizedQueue.cbc perlTests +Executor.h TaskIterator.cbc plautogen +Iterator.h TaskManager.h stack.agda +Lock.h TaskManagerImpl.cbc temp.cbc +LockImpl.cbc Timer.h test +MCTaskManagerImpl.cbc TimerImpl.cbc tmp_tool +MCTaskManagerImpl.h Todo tools +Makefile Tree.h twice +ModelChecking Worker.h verifier +MultiDimIterator.cbc cleanup.sh +ichikitakahiro % cat Queue.h +typedef struct Queue<>{ + __code whenEmpty(...); + __code clear(Impl* queue, __code next(...)); + __code put(Impl* queue, union Data* data, __code next(...)); + __code take(Impl* queue, __code next(union Data* data, ...)); + __code isEmpty(Impl* queue, __code next(...), __code whenEmpty(...)); + __code next(...); +} Queue; +ichikitakahiro % cat Lock.h +typedef struct Lock<>{ + union Data* lock; + __code doLock(Impl* lock, __code next(...)); + __code doUnlock(Impl* lock, __code next(...)); + __code next(...); +} Lock; +ichikitakahiro % perl tools/static_gen_header.pl --interface Wc +typedef struct Wc <> { + __code next(...); +} Wc; +ichikitakahiro % perl tools/static_gen_header.pl --interface Wc -o examples/wc/wc.h +ichikitakahiro % ls examples/wc/wc.h +examples/wc/wc.h +ichikitakahiro % vim examples/wc/wc.h +ichikitakahiro % vim examples/wc/wc.h +ichikitakahiro % cat examples/wc/wc.h +typedef struct Wc <> { + __code openFile(Impl* wc,char* filename, __code next(...)); + __code countUp(Impl* wc,__code next(struct)); + + __code next(...); +} Wc; +ichikitakahiro % cat examples/wc/wc.h | wc + 6 19 162 +ichikitakahiro % vim examples/wc/wc.h +ichikitakahiro % perl tools/static_gen_header.pl --interface Wc --impl WcImpl -o examples/wc/WcImpl.h +ichikitakahiro % vim examples/wc/!$ +vim examples/wc/examples/wc/WcImpl.h +ichikitakahiro % vim examples/wc/WcImpl.h +ichikitakahiro % perl tools/impl2cbc.pl examples/wc/WcImpl.h +require file at /Users/ichikitakahiro/src/firefly/hg/Gears/Gears/src/parallel_execution/tools/../lib/Gears/Interface.pm line 15. + Gears::Interface::parse("Gears::Interface", undef) called at /Users/ichikitakahiro/src/firefly/hg/Gears/Gears/src/parallel_execution/tools/../lib/Gears/Interface.pm line 166 + Gears::Interface::detailed_parse("Gears::Interface", undef) called at tools/impl2cbc.pl line 27 +ichikitakahiro % vim examples/wc/WcImpl.h +ichikitakahiro % vim examples/wc/wc.h +ichikitakahiro % mv examples/wc/wc.h examples/wc/Wc.h +ichikitakahiro % perl tools/impl2cbc.pl examples/wc/WcImpl.h +#include "../../../context.h" +#interface "Wc.h" + +// ---- +// typedef struct WcImpl <> impl Wc { +// FILE* file; +// char* Keyword; +// int wordNum; +// } WcImpl; +// ---- + +Wc* createWcImpl(struct Context* context) { + struct Wc* wc = new Wc(); + struct WcImpl* wc_impl = new WcImpl(); + wc->wc = (union Data*)wc_impl; + wc->filename = NULL; + wc->result = NULL; + wc_impl->file = NULL; + wc_impl->Keyword = NULL; + wc_impl->wordNum = 0; + wc->openFile = C_openFileWcImpl; + wc->countUp = C_countUpWcImpl; + return wc; +} +__code openFile(struct WcImpl* wc,char* filename, __code next(...)) { + + goto next(...); +} + +__code countUp(struct WcImpl* wc,__code next(WcResult* result, ...)) { + + goto next(WcResult* result, ...); +} + +ichikitakahiro % ls +Atomic.h Queue.h compare.c +AtomicReference.cbc RedBlackTree.agda cuda.c +AtomicT.h RedBlackTree.cbc examples +AtomicTImpl.cbc RedBlackTreeReWright.cbc generate_context.pl +AtomicTImpl.h Semaphore.h generate_stub.pl +Buffer.h SemaphoreImpl.cbc helper_cuda.h +CMakeLists.txt SingleLinkedQueue.cbc helper_string.h +CPUWorker.cbc SingleLinkedStack.cbc impl +CUDAExecutor.cbc SpinLock.cbc interface +CUDAWorker.cbc Stack.h lib +CodeGear.h SynchronizedQueue.cbc perlTests +Executor.h TaskIterator.cbc plautogen +Iterator.h TaskManager.h stack.agda +Lock.h TaskManagerImpl.cbc temp.cbc +LockImpl.cbc Timer.h test +MCTaskManagerImpl.cbc TimerImpl.cbc tmp_tool +MCTaskManagerImpl.h Todo tools +Makefile Tree.h twice +ModelChecking Worker.h verifier +MultiDimIterator.cbc cleanup.sh +ichikitakahiro % perl tools/impl2cbc.pl examples/wc/WcImpl.h -w +#include "../../../context.h" +#interface "Wc.h" + +// ---- +// typedef struct WcImpl <> impl Wc { +// FILE* file; +// char* Keyword; +// int wordNum; +// } WcImpl; +// ---- + +Wc* createWcImpl(struct Context* context) { + struct Wc* wc = new Wc(); + struct WcImpl* wc_impl = new WcImpl(); + wc->wc = (union Data*)wc_impl; + wc->filename = NULL; + wc->result = NULL; + wc_impl->file = NULL; + wc_impl->Keyword = NULL; + wc_impl->wordNum = 0; + wc->openFile = C_openFileWcImpl; + wc->countUp = C_countUpWcImpl; + return wc; +} +__code openFile(struct WcImpl* wc,char* filename, __code next(...)) { + + goto next(...); +} + +__code countUp(struct WcImpl* wc,__code next(WcResult* result, ...)) { + + goto next(WcResult* result, ...); +} + +ichikitakahiro % perl tools/impl2cbc.pl -w examples/wc/WcImpl.h +ichikitakahiro % ls examples/wc/ +Wc.h WcImpl.cbc WcImpl.h WcResult.h main.cbc +ichikitakahiro % vi examples/wc/WcImpl.cbc +ichikitakahiro % vim examples/wc/WcImpl.cbc +ichikitakahiro % vim tools/impl2cbc.pl +ichikitakahiro % vim examples/wc/WcImpl.cbc +ichikitakahiro % vim examples/wc/Wc.h +ichikitakahiro % vim examples/wc/Wc.h +ichikitakahiro % vim examples/DPP2/main.cbc +ichikitakahiro % vim examples/wc/Wc.h +ichikitakahiro % + + + + + + + + + + + + + + + + + + + diff -r 3d4b02ddac9f -r 81cf42d17859 log28pm_index.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/log28pm_index.txt Sun Feb 28 18:08:51 2021 +0900 @@ -0,0 +1,1172 @@ +Last login: Wed Feb 24 15:57:31 on ttys000 +ichikitakahiro % ssh One +ssh: Could not resolve hostname one: nodename nor servname provided, or not known +ichikitakahiro % ssh one +ssh: Could not resolve hostname one: nodename nor servname provided, or not known +ichikitakahiro % less ~/.ssh +/Users/ichikitakahiro/.ssh is a directory +ichikitakahiro % less ~/.ssh_config +/Users/ichikitakahiro/.ssh_config: No such file or directory +ichikitakahiro % ls -a +#.sssh# .wacom +#ExampleAdd.java# .wapi +#StudentScore.java# .yarnrc +#basic.c# .zcompdump +#draw_lot.py# .zprofile +#my.ini# .zsh_history +#number_of_drawing.py# .zshrc +#report1.sh# .zshrc.backup +#report4.py# .zshrc~ +#test.zsh# Applications +. Brewfile +.. Desktop +.ActivePerl Documents +.CFUserTextEncoding Downloads +.DS_Store Fedora +.IdentityService GIT +.ServiceHub IdeaProjects +.Trash Library +.VID056e_PID00e4.xml Movies +.VID056e_PID0103.xml Music +.anaconda NumMeth.h +.android Papers +.ansible Pictures +.appletviewer Public +.artisoc PycharmProjects +.astah Scala +.astropy Sites +.atom Space +.bash_history SqlViewerHistory.props +.bash_profile Unity +.bash_profile-anaconda3.bak Untitled.ipynb +.bash_profile~ Untitled1.ipynb +.bash_sessions Untitled2.ipynb +.bashrc Untitled3.ipynb +.bashrc~ VirtualBox VMs +.cache __pycache__ +.conda anaconda3 +.condarc artisoc_files +.config basic.c +.coursier basic.c~ +.cpan build +.cups build.sbt +.designer chat-ex +.docker client6.pl +.dotnet count_daily.sh +.emacs.d count_daily.sh~ +.freemind daily_access.dat~ +.gem daily_accesses +.gitconfig draw_lot.py +.gitflow_export draw_lot.py~ +.gitignore_global e165713.gplot +.gnuplot_history e1657XX.gplot +.gnuplot_history- e1657XX.jpeg +.gnuplot_history-05967.tmp ex8_1.py +.gnuplot_history-06223.tmp ex8_1.py~ +.gnuplot_history-07978.tmp gcc-10.1.0 +.gnuplot_history-13850.tmp go +.gnuplot_history-17012.tmp google-cloud-sdk +.gnuplot_history-20087.tmp info1_obj2_start +.gnuplot_history-23037.tmp insertion_sort +.gnuplot_history-26341.tmp iris.data +.gnuplot_history-31205.tmp iris2.data +.gnuplot_history-40898.tmp java_intro +.gnuplot_history-41419.tmp jp +.gnuplot_history-48689.tmp jupyter_example.ipynb +.gnuplot_history-61862.tmp jupyter_test.py.ipynb +.gnuplot_history-73430.tmp kinds +.gradle level.sh +.hgignore_global make_pass,py~ +.hgrc make_pass.py~ +.hgrc.swp menu.ch +.idea menu.sh~ +.idea-build mkhtml.sh +.ipynb_checkpoints my.cnf +.ipython my.cnf~ +.ivy2 nertest +.jude opdes.py +.jupyter orig.py +.keras orig.py~ +.lesshst plot.sh +.lldb plot.sh~ +.local plot_graph.py +.m2 prog2-temp +.matplotlib prog2_c +.mono project +.my.cnf pycharm_example +.mysql_history pyside2 +.npm report4.py~ +.nuxtrc report42.py +.omnisharp report_software.tex~ +.oracle_jre_usage reportskel +.perl-cpm score.csv +.plenv si-kennsu~ +.pyenv spark-2.4.5-bin-hadoop2.7 +.pylint.d src +.python_history struct.c +.python_history-58407.tmp struct.c~ +.rbenv target +.sbt temp +.scala_history test +.sh_history test.py~ +.slideshow test1.txt +.ssh test2.txt +.subversion tex +.tempPath.xml texput.log +.thumbnails timing +.tmux.conf week7.py~ +.vim workspace +.viminfo www_dir +.virtualenvs 計算機 +.vscode 新規フォルダ +ichikitakahiro % cd ~/.ssh +ichikitakahiro % ls +#config# github.pub id_rsa_localhost +#environment# id_rsa id_rsa_localhost.pub +config id_rsa.pub known_hosts +config~ id_rsa_k208573 test-ansible +github id_rsa_k208573.pub test-ansible.pub +ichikitakahiro % cat config +Host github.com + IdentityFile ~/.ssh/github + Host newFedora +HostName localhost +port 2222 +IdentityFile ~/.ssh/test-ansible +User root + +Host sakura + HostName 2401:2500:10a:1011::C + IdentityFile ~/.ssh/id_rsa + User ie-user + + +Host yomitan +HostName yomitan.ie.u-ryukyu.ac.jp +User e165713 +IdentityFile ~/.ssh/id_rsa +ForwardAgent yes +ForwardX11 yes +ServerAliveInterval 300 +ForwardX11Timeout 596h +ControlMaster auto +ControlPath ~/.ssh/mux-%r@%h:%p +ControlPersist 30m + +Host tino-vm1 +HostName tino-vm1.ads.ie.u-ryukyu.ac.jp +User ie-user +IdentityFile ~/.ssh/id_rsa +ProxyCommand ssh -W %h:%p yomitan +#ForwardAgent yes +#ForwardX11 yes +#ServerAliveInterval 300 +#ForwardX11Timeout 596h +#ControlMaster auto +#ControlPath ~/.ssh/mux-%r@%h:%p +#ControlPersist 30m + +Host firefly +HostName firefly.cr.ie.u-ryukyu.ac.jp +User one +ichikitakahiro % ssh firefly +Last login: Wed Feb 24 15:46:03 2021 from 10.0.2.88 ++firefly+one pwd +/Users/one ++firefly+one ls +Advanced software.mm Pictures/ malloc_test.c +AndroidStudioProjects/ Projects/ memo +Applications/ Public/ mlock-test.c +Desktop/ Sites/ note/ +Documents/ VirtualBox VMs/ src/ +Downloads/ bin/ tightvnc-jviewer.jar +Library/ drivers/ tmp/ +Movies/ hg/ workspace/ +Music/ internal/ zscript/ +Paper/ kernel-xv6.img* ++firefly+one cd drivers ++firefly+one ls +MacScanSnapV62L11JP2.dmg ++firefly+one pwd +/Users/one/drivers ++firefly+one exit +Connection to firefly.cr.ie.u-ryukyu.ac.jp closed. +ichikitakahiro % cd ~/src/firefly/hg/CbC/CbC_examples/ +ichikitakahiro % ls +Makefile test2.exe +arg.c test_cs.c +arg.exe test_cs.exe +c-next.c test_csp1.c +c-next.exe test_csp1.exe +c-next1.c test_func2code.c +code_segment_pointer_check test_func2code.exe +conv1.c test_para.c +conv1.exe test_para.exe +fact-a.c test_para2.c +fact-a.exe test_para2.exe +fact-e.c test_para3.c +goto.c test_para3.exe +goto.exe test_para4.c +loto6.c test_para4.exe +loto6.exe test_tree.c +quicksort test_tree.exe +regexp tmp1.c +stack1.c tmp1.exe +stack1.exe tmp2.c +test02.c tmp2.exe +test02.exe tmp4.c +test05.c tmp4.exe +test05.exe tmpa.c +test1.c tmpa.exe +test1.exe too-long-argument.c +test2.c too-long-argument.exe +ichikitakahiro % make +for exe in arg.exe conv1.exe fact-a.exe goto.exe loto6.exe stack1.exe test02.exe test05.exe test1.exe test2.exe test_cs.exe test_csp1.exe test_func2code.exe test_para2.exe test_para3.exe test_para4.exe test_para.exe test_tree.exe tmp1.exe tmp2.exe tmp4.exe tmpa.exe too-long-argument.exe c-next.exe ; do \ + ./${exe} ; \ + done +#0017:arg1: 0 1 2 3 4 : 1 1 +#0024:arg1: 1 2 3 4 0 : 1 1 +#0035:args: 1 2 3 4 0 : 1 0 +#0089:321=0 +#0045:args3: 11 22 33 44 55 : 1 2 3 4 +#0047:args3: args0 11 22 33 44 55 : args1 66 77 88 99 10 : 1 2 3 4 +#0057:args4: 11 22 33 44 55 : 2 3 4 1 +#0064:args5: 11 22 33 44 55 : 3 4 1 2 +#0071:args6: 11 22 33 44 55 : 3 4 1 2 +#0045:args3: 11 22 33 44 55 : 3 4 1 2 +#0047:args3: args0 11 22 33 44 55 : args1 11 22 33 44 55 : 3 4 1 2 +#0165:720 +#0032:10! = 3628800 +#0023:a2 1 a3 +#0030:a3 2 a4 +#0037:a4 3 a5 +#0044:a5 4 a6 +#0051:a6 5 a7 +#0058:a7 6 a8 +#0065:a8 7 a9 +#0072:a9 8 xx +31-32-33-13-4-35 +#0108:sp: 0 1 +#0070:f0 1 sp: 0 +#0072:f0 2 sp: ffffffe0 +#0078:f0 3 sp: ffffffe0 +#0042:f 0 sp: ffffffe0 +#0046:f 1 sp: ffffffe0 +#0048:f 2 sp: ffffffc8 +#0114:13 1 +test code + test_goto: a = 20 + test_code: return 10 +main: ret = 0 +in f01: 12 +in f02: 13, 13.200000 +in f01: 14 +in cs01: 14 +in end: +#0115:sp: 0 1 +#0075:f0 1 sp: 0 +#0077:f0 2 sp: ffffffe0 +#0083:f0 3 sp: ffffffe0 +#0047:f 0 sp: ffffffe0 +#0051:f 1 sp: ffffffe0 +#0053:f 2 sp: ffffffc8 +#0121:13 1 +#0040:main bit: 1 +#0041:main message: hogehoge +#0026:initSender bit: 1 +#0027:initSender message: hogehoge +#0028:sender_bit: 0 +#0017:bit: 1 +#0018:message: hogehoge +main start + 10, 20, 30, 40 + 50, 60, 70, 80 + 90, 100, 110 +cs_exit was called! +function: +a=10.010000, b=20.020000, c=30 +csp = 5f71cc7. +cs_cs0 : a=30, b=60, c=40, d=70. +cs_exit : a=7500. +in continuation: go code segment cs0 +in cs0: x = 20, y = 400. +in cs0: will exit with code 8000. +cs_goto : a=10, b=20, c=30, d=40. +cs_cs0 : a=20, b=30, c=40, d=10. +cs_exit : a=3400. +function : + struct abc: + a=10, b=20.020000, c=0, d=0xad + struct def: + d=30, f=0xbf + struct abc: + a=50, b=60.060000, c=1, d=0xed +cs_goto : +c=100 + struct abc: + a=10, b=20.020000, c=0, d=0xad + struct def: + d=30, f=0xbf + struct abc: + a=50, b=60.060000, c=1, d=0xed +cs0 : +c=100 + struct abc: + a=10, b=20.020000, c=0, d=0xad + struct def: + d=30, f=0xbf + struct abc: + a=50, b=60.060000, c=1, d=0xed +cs_exit : a=1001. +function: a=10, b=20, c=30, d=40, e=50, f=60, g=70, h=80, i=90, j=100 +function: a=110, b=120, c=130, d=140, e=150, f=160, g=170, h=180, i=190, j=200 +cs_goto : a=10, b=20, c=30, d=40, e=50, f=60, g=70, h=80, i=90, j=100 +cs_goto : a=110, b=120, c=130, d=140, e=150, f=160, g=170, h=180, i=190, j=200 +cs0 : a=20, b=30, c=40, d=50, e=60, f=10, g=10, h=10, i=10, j=10 +cs0 : a=10, b=10, c=10, d=10, e=10, f=10, g=10, h=10, i=10, j=10 +cs_exit : a=700. b=14003 +it is in main. +cs0 was called: a=11, b=22.200000, c=33, d=44. +cs_exit was called: a=1610. +t = 220.000000 +test_goto +__code cs1 was called. +a = 2, b = 10.200000, c = 3, d = 4 +#0087:main continue. +#0089:main end. +#0021:2: ./tmp2.exe +#0032:3: ./tmp2.exe +#0041:4: ./tmp2.exe +#0012:1: ./tmp2.exe 1234 +#0025:2: tmp4.exe +#0037:3: i=123 j=456 k=789 av[0]=tmp4.exe p=tmp4.exe +#0047:4: tmp4.exe +#0057:5: tmp4.exe +#0058:5: i=123 j=456 k=789 +#0012:1: tmp4.exe 1234 +#0014:charno:5 x,y:50.000000,30.000000 hp:100 +#0045:0 0 +#0026:15 +#0092:main4 +#0017:tcode2: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +#0094:main2 +#0028:tcode1: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +#0096:main0 +#0017:tcode2: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +#0098:main1 +#0028:tcode1: f1=0,f2=1,f3=2,f4=3,f5=4,f6=5,f7=6,f8=7,f9=8,fa=9,fb=10,fc=11,fd=12,fe=13,ff=14 +ichikitakahiro % ls +Makefile test2.exe +arg.c test_cs.c +arg.exe test_cs.exe +c-next.c test_csp1.c +c-next.exe test_csp1.exe +c-next1.c test_func2code.c +code_segment_pointer_check test_func2code.exe +conv1.c test_para.c +conv1.exe test_para.exe +fact-a.c test_para2.c +fact-a.exe test_para2.exe +fact-e.c test_para3.c +goto.c test_para3.exe +goto.exe test_para4.c +loto6.c test_para4.exe +loto6.exe test_tree.c +quicksort test_tree.exe +regexp tmp1.c +stack1.c tmp1.exe +stack1.exe tmp2.c +test02.c tmp2.exe +test02.exe tmp4.c +test05.c tmp4.exe +test05.exe tmpa.c +test1.c tmpa.exe +test1.exe too-long-argument.c +test2.c too-long-argument.exe +ichikitakahiro % pwd +/Users/ichikitakahiro/src/firefly/hg/CbC/CbC_examples +ichikitakahiro % cd .. +ichikitakahiro % ls +CbC_examples CbC_gcc +ichikitakahiro % cd .. +ichikitakahiro % ls +CbC Gears +ichikitakahiro % cd ~/workspace +ichikitakahiro % ls +cr test +ichikitakahiro % cd cr/test_space +ichikitakahiro % ls +a.out test.c tsts +ichikitakahiro % vim test.c +ichikitakahiro % vim ~/.vimrc +ichikitakahiro % vim test.c +ichikitakahiro % vim ~/.zshrc +ichikitakahiro % $GCC_COMPILER +gcc: fatal error: no input files +compilation terminated. +ichikitakahiro % vim ~/.zshrc +ichikitakahiro % vim ~/.zshrc +ichikitakahiro % . !$ +. ~/.zshrc +ichikitakahiro % $CBC_COMPILER -Wall test.c +ichikitakahiro % ls +a.out test.c tsts +ichikitakahiro % ./a.out +Hello +i = 10 +ichikitakahiro % $CBC_COMPILER -Wall -S test.c +ichikitakahiro % ls +a.out test.c test.s tsts +ichikitakahiro % less test.s +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test.c +ichikitakahiro % ls -ltr +total 80 +-rwxr-xr-x 1 ichikitakahiro staff 12556 2 13 12:48 tsts +-rw-r--r-- 1 ichikitakahiro staff 156 2 28 10:52 test.c +-rw-r--r-- 1 ichikitakahiro staff 2293 2 28 10:57 test.s +-rwxr-xr-x 1 ichikitakahiro staff 13044 2 28 11:05 a.out +drwxr-xr-x 3 ichikitakahiro staff 96 2 28 11:05 a.out.dSYM +ichikitakahiro % lldb a.out +(lldb) target create "a.out" +Current executable set to 'a.out' (x86_64). +(lldb) b main +Breakpoint 1: where = a.out`main + 4 at test.c:14:8, address = 0x0000000100000ee4 +(lldb) process la +Process 68542 launched: '/Users/ichikitakahiro/workspace/cr/test_space/a.out' (x86_64) +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 + frame #0: 0x0000000100000ee4 a.out`main at test.c:14:8 + 11 } + 12 + 13 int main(){ +-> 14 goto CG1(); + 15 } +Target 0: (a.out) stopped. +(lldb) dissas +error: 'dissas' is not a valid command. +(lldb) info reg +error: 'info' is not a valid command. +(lldb) register read +General Purpose Registers: + rax = 0x0000000100000ee0 a.out`main at test.c:13:11 + rbx = 0x0000000000000000 + rcx = 0x00007ffeefbff630 + rdx = 0x00007ffeefbff520 + rdi = 0x0000000000000001 + rsi = 0x00007ffeefbff510 + rbp = 0x00007ffeefbff4f0 + rsp = 0x00007ffeefbff4f0 + r8 = 0x0000000000000000 + r9 = 0x0000000000000000 + r10 = 0x0000000000000000 + r11 = 0x0000000000000000 + r12 = 0x0000000000000000 + r13 = 0x0000000000000000 + r14 = 0x0000000000000000 + r15 = 0x0000000000000000 + rip = 0x0000000100000ee4 a.out`main + 4 at test.c:14:8 + rflags = 0x0000000000000246 + cs = 0x000000000000002b + fs = 0x0000000000000000 + gs = 0x0000000000000000 + +(lldb) x/20i $rip +-> 0x100000ee4: 48 81 ec 00 04 00 00 subq $0x400, %rsp ; imm = 0x400 + 0x100000eeb: b8 00 00 00 00 movl $0x0, %eax + 0x100000ef0: e8 d0 ff ff ff callq 0x100000ec5 ; CG1 at test.c:8:13 + 0x100000ef5: 48 81 c4 00 04 00 00 addq $0x400, %rsp ; imm = 0x400 + 0x100000efc: 90 nop + 0x100000efd: 90 nop + 0x100000efe: c9 leave + 0x100000eff: c3 retq + 0x100000f00: ff 25 fa 10 00 00 jmpq *0x10fa(%rip) ; (void *)0x0000000100000f1c + 0x100000f06: ff 25 fc 10 00 00 jmpq *0x10fc(%rip) ; (void *)0x0000000100000f26 + 0x100000f0c: 4c 8d 1d fd 10 00 00 leaq 0x10fd(%rip), %r11 ; _dyld_private + 0x100000f13: 41 53 pushq %r11 + 0x100000f15: ff 25 e5 00 00 00 jmpq *0xe5(%rip) ; (void *)0x00007fff6f632578: dyld_stub_binder + 0x100000f1b: 90 nop + 0x100000f1c: 68 00 00 00 00 pushq $0x0 + 0x100000f21: e9 e6 ff ff ff jmp 0x100000f0c + 0x100000f26: 68 0e 00 00 00 pushq $0xe + 0x100000f2b: e9 dc ff ff ff jmp 0x100000f0c + 0x100000f30: 69 20 3d 20 25 64 imull $0x6425203d, (%rax), %esp ; imm = 0x6425203D + 0x100000f36: 0a 00 orb (%rax), %al +(lldb) step i +error: invalid thread index 'i'. +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000eeb a.out`main at test.c:14:8 + 11 } + 12 + 13 int main(){ +-> 14 goto CG1(); + 15 } +Target 0: (a.out) stopped. +(lldb) x/20i $rip +-> 0x100000eeb: b8 00 00 00 00 movl $0x0, %eax + 0x100000ef0: e8 d0 ff ff ff callq 0x100000ec5 ; CG1 at test.c:8:13 + 0x100000ef5: 48 81 c4 00 04 00 00 addq $0x400, %rsp ; imm = 0x400 + 0x100000efc: 90 nop + 0x100000efd: 90 nop + 0x100000efe: c9 leave + 0x100000eff: c3 retq + 0x100000f00: ff 25 fa 10 00 00 jmpq *0x10fa(%rip) ; (void *)0x0000000100000f1c + 0x100000f06: ff 25 fc 10 00 00 jmpq *0x10fc(%rip) ; (void *)0x0000000100000f26 + 0x100000f0c: 4c 8d 1d fd 10 00 00 leaq 0x10fd(%rip), %r11 ; _dyld_private + 0x100000f13: 41 53 pushq %r11 + 0x100000f15: ff 25 e5 00 00 00 jmpq *0xe5(%rip) ; (void *)0x00007fff6f632578: dyld_stub_binder + 0x100000f1b: 90 nop + 0x100000f1c: 68 00 00 00 00 pushq $0x0 + 0x100000f21: e9 e6 ff ff ff jmp 0x100000f0c + 0x100000f26: 68 0e 00 00 00 pushq $0xe + 0x100000f2b: e9 dc ff ff ff jmp 0x100000f0c + 0x100000f30: 69 20 3d 20 25 64 imull $0x6425203d, (%rax), %esp ; imm = 0x6425203D + 0x100000f36: 0a 00 orb (%rax), %al + 0x100000f38: 48 65 gs +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000ef0 a.out`main at test.c:14:8 + 11 } + 12 + 13 int main(){ +-> 14 goto CG1(); + 15 } +Target 0: (a.out) stopped. +(lldb) x/20i $rip +-> 0x100000ef0: e8 d0 ff ff ff callq 0x100000ec5 ; CG1 at test.c:8:13 + 0x100000ef5: 48 81 c4 00 04 00 00 addq $0x400, %rsp ; imm = 0x400 + 0x100000efc: 90 nop + 0x100000efd: 90 nop + 0x100000efe: c9 leave + 0x100000eff: c3 retq + 0x100000f00: ff 25 fa 10 00 00 jmpq *0x10fa(%rip) ; (void *)0x0000000100000f1c + 0x100000f06: ff 25 fc 10 00 00 jmpq *0x10fc(%rip) ; (void *)0x0000000100000f26 + 0x100000f0c: 4c 8d 1d fd 10 00 00 leaq 0x10fd(%rip), %r11 ; _dyld_private + 0x100000f13: 41 53 pushq %r11 + 0x100000f15: ff 25 e5 00 00 00 jmpq *0xe5(%rip) ; (void *)0x00007fff6f632578: dyld_stub_binder + 0x100000f1b: 90 nop + 0x100000f1c: 68 00 00 00 00 pushq $0x0 + 0x100000f21: e9 e6 ff ff ff jmp 0x100000f0c + 0x100000f26: 68 0e 00 00 00 pushq $0xe + 0x100000f2b: e9 dc ff ff ff jmp 0x100000f0c + 0x100000f30: 69 20 3d 20 25 64 imull $0x6425203d, (%rax), %esp ; imm = 0x6425203D + 0x100000f36: 0a 00 orb (%rax), %al + 0x100000f38: 48 65 gs + 0x100000f3a: 6c insb %dx, %es:(%rdi) +(lldb) bt +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + * frame #0: 0x0000000100000ef0 a.out`main at test.c:14:8 + frame #1: 0x00007fff6f633cc9 libdyld.dylib`start + 1 +(lldb) register read +General Purpose Registers: + rax = 0x0000000000000000 + rbx = 0x0000000000000000 + rcx = 0x00007ffeefbff630 + rdx = 0x00007ffeefbff520 + rdi = 0x0000000000000001 + rsi = 0x00007ffeefbff510 + rbp = 0x00007ffeefbff4f0 + rsp = 0x00007ffeefbff0f0 + r8 = 0x0000000000000000 + r9 = 0x0000000000000000 + r10 = 0x0000000000000000 + r11 = 0x0000000000000000 + r12 = 0x0000000000000000 + r13 = 0x0000000000000000 + r14 = 0x0000000000000000 + r15 = 0x0000000000000000 + rip = 0x0000000100000ef0 a.out`main + 16 at test.c:14:8 + rflags = 0x0000000000000206 + cs = 0x000000000000002b + fs = 0x0000000000000000 + gs = 0x0000000000000000 + +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000ec5 a.out`CG1 at test.c:8:13 + 5 printf("i = %d\n", i); + 6 } + 7 +-> 8 __code CG1(){ + 9 printf("Hello\n"); + 10 goto CG2(); + 11 } +Target 0: (a.out) stopped. +(lldb) bt +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + * frame #0: 0x0000000100000ec5 a.out`CG1 at test.c:8:13 + frame #1: 0x0000000100000ef5 a.out`main at test.c:14:8 + frame #2: 0x00007fff6f633cc9 libdyld.dylib`start + 1 +(lldb) register read +General Purpose Registers: + rax = 0x0000000000000000 + rbx = 0x0000000000000000 + rcx = 0x00007ffeefbff630 + rdx = 0x00007ffeefbff520 + rdi = 0x0000000000000001 + rsi = 0x00007ffeefbff510 + rbp = 0x00007ffeefbff4f0 + rsp = 0x00007ffeefbff0e8 + r8 = 0x0000000000000000 + r9 = 0x0000000000000000 + r10 = 0x0000000000000000 + r11 = 0x0000000000000000 + r12 = 0x0000000000000000 + r13 = 0x0000000000000000 + r14 = 0x0000000000000000 + r15 = 0x0000000000000000 + rip = 0x0000000100000ec5 a.out`CG1 at test.c:8:13 + rflags = 0x0000000000000206 + cs = 0x000000000000002b + fs = 0x0000000000000000 + gs = 0x0000000000000000 + +(lldb) x/20i $rip +-> 0x100000ec5: 55 pushq %rbp + 0x100000ec6: 48 89 e5 movq %rsp, %rbp + 0x100000ec9: 48 8d 3d 68 00 00 00 leaq 0x68(%rip), %rdi ; "Hello" + 0x100000ed0: e8 31 00 00 00 callq 0x100000f06 ; symbol stub for: puts + 0x100000ed5: b8 00 00 00 00 movl $0x0, %eax + 0x100000eda: 5d popq %rbp + 0x100000edb: e9 bd ff ff ff jmp 0x100000e9d ; CG2 at test.c:3:13 + 0x100000ee0: 55 pushq %rbp + 0x100000ee1: 48 89 e5 movq %rsp, %rbp + 0x100000ee4: 48 81 ec 00 04 00 00 subq $0x400, %rsp ; imm = 0x400 + 0x100000eeb: b8 00 00 00 00 movl $0x0, %eax + 0x100000ef0: e8 d0 ff ff ff callq 0x100000ec5 ; CG1 at test.c:8:13 + 0x100000ef5: 48 81 c4 00 04 00 00 addq $0x400, %rsp ; imm = 0x400 + 0x100000efc: 90 nop + 0x100000efd: 90 nop + 0x100000efe: c9 leave + 0x100000eff: c3 retq + 0x100000f00: ff 25 fa 10 00 00 jmpq *0x10fa(%rip) ; (void *)0x0000000100000f1c + 0x100000f06: ff 25 fc 10 00 00 jmpq *0x10fc(%rip) ; (void *)0x0000000100000f26 + 0x100000f0c: 4c 8d 1d fd 10 00 00 leaq 0x10fd(%rip), %r11 ; _dyld_private +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000ec6 a.out`CG1 at test.c:8:13 + 5 printf("i = %d\n", i); + 6 } + 7 +-> 8 __code CG1(){ + 9 printf("Hello\n"); + 10 goto CG2(); + 11 } +Target 0: (a.out) stopped. +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000ec9 a.out`CG1 at test.c:9:3 + 6 } + 7 + 8 __code CG1(){ +-> 9 printf("Hello\n"); + 10 goto CG2(); + 11 } + 12 +Target 0: (a.out) stopped. +(lldb) +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000ed0 a.out`CG1 at test.c:9:3 + 6 } + 7 + 8 __code CG1(){ +-> 9 printf("Hello\n"); + 10 goto CG2(); + 11 } + 12 +Target 0: (a.out) stopped. +(lldb) x/20i $rip +-> 0x100000ed0: e8 31 00 00 00 callq 0x100000f06 ; symbol stub for: puts + 0x100000ed5: b8 00 00 00 00 movl $0x0, %eax + 0x100000eda: 5d popq %rbp + 0x100000edb: e9 bd ff ff ff jmp 0x100000e9d ; CG2 at test.c:3:13 + 0x100000ee0: 55 pushq %rbp + 0x100000ee1: 48 89 e5 movq %rsp, %rbp + 0x100000ee4: 48 81 ec 00 04 00 00 subq $0x400, %rsp ; imm = 0x400 + 0x100000eeb: b8 00 00 00 00 movl $0x0, %eax + 0x100000ef0: e8 d0 ff ff ff callq 0x100000ec5 ; CG1 at test.c:8:13 + 0x100000ef5: 48 81 c4 00 04 00 00 addq $0x400, %rsp ; imm = 0x400 + 0x100000efc: 90 nop + 0x100000efd: 90 nop + 0x100000efe: c9 leave + 0x100000eff: c3 retq + 0x100000f00: ff 25 fa 10 00 00 jmpq *0x10fa(%rip) ; (void *)0x0000000100000f1c + 0x100000f06: ff 25 fc 10 00 00 jmpq *0x10fc(%rip) ; (void *)0x0000000100000f26 + 0x100000f0c: 4c 8d 1d fd 10 00 00 leaq 0x10fd(%rip), %r11 ; _dyld_private + 0x100000f13: 41 53 pushq %r11 + 0x100000f15: ff 25 e5 00 00 00 jmpq *0xe5(%rip) ; (void *)0x00007fff6f632578: dyld_stub_binder + 0x100000f1b: 90 nop +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000f06 a.out`puts +a.out`puts: +-> 0x100000f06 <+0>: jmpq *0x10fc(%rip) ; (void *)0x0000000100000f26 + 0x100000f0c: leaq 0x10fd(%rip), %r11 ; _dyld_private + 0x100000f13: pushq %r11 + 0x100000f15: jmpq *0xe5(%rip) ; (void *)0x00007fff6f632578: dyld_stub_binder +Target 0: (a.out) stopped. +(lldb) bt +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + * frame #0: 0x0000000100000f06 a.out`puts + frame #1: 0x0000000100000ed5 a.out`CG1 at test.c:9:3 + frame #2: 0x0000000100000ef5 a.out`main at test.c:14:8 + frame #3: 0x00007fff6f633cc9 libdyld.dylib`start + 1 +(lldb) fin +Hello +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step out + + frame #0: 0x0000000100000ed5 a.out`CG1 at test.c:10:8 + 7 + 8 __code CG1(){ + 9 printf("Hello\n"); +-> 10 goto CG2(); + 11 } + 12 + 13 int main(){ +Target 0: (a.out) stopped. +(lldb) x/20i $rip +-> 0x100000ed5: b8 00 00 00 00 movl $0x0, %eax + 0x100000eda: 5d popq %rbp + 0x100000edb: e9 bd ff ff ff jmp 0x100000e9d ; CG2 at test.c:3:13 + 0x100000ee0: 55 pushq %rbp + 0x100000ee1: 48 89 e5 movq %rsp, %rbp + 0x100000ee4: 48 81 ec 00 04 00 00 subq $0x400, %rsp ; imm = 0x400 + 0x100000eeb: b8 00 00 00 00 movl $0x0, %eax + 0x100000ef0: e8 d0 ff ff ff callq 0x100000ec5 ; CG1 at test.c:8:13 + 0x100000ef5: 48 81 c4 00 04 00 00 addq $0x400, %rsp ; imm = 0x400 + 0x100000efc: 90 nop + 0x100000efd: 90 nop + 0x100000efe: c9 leave + 0x100000eff: c3 retq + 0x100000f00: ff 25 fa 10 00 00 jmpq *0x10fa(%rip) ; (void *)0x0000000100000f1c + 0x100000f06: ff 25 fc 10 00 00 jmpq *0x10fc(%rip) ; (void *)0x00007fff6f6c2630: puts + 0x100000f0c: 4c 8d 1d fd 10 00 00 leaq 0x10fd(%rip), %r11 ; _dyld_private + 0x100000f13: 41 53 pushq %r11 + 0x100000f15: ff 25 e5 00 00 00 jmpq *0xe5(%rip) ; (void *)0x00007fff6f632578: dyld_stub_binder + 0x100000f1b: 90 nop + 0x100000f1c: 68 00 00 00 00 pushq $0x0 +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000eda a.out`CG1 at test.c:11:1 + 8 __code CG1(){ + 9 printf("Hello\n"); + 10 goto CG2(); +-> 11 } + 12 + 13 int main(){ + 14 goto CG1(); +Target 0: (a.out) stopped. +(lldb) +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000edb a.out`CG1 at test.c:10:8 + 7 + 8 __code CG1(){ + 9 printf("Hello\n"); +-> 10 goto CG2(); + 11 } + 12 + 13 int main(){ +Target 0: (a.out) stopped. +(lldb) register read +General Purpose Registers: + rax = 0x0000000000000000 + rbx = 0x0000000000000000 + rcx = 0x00000001000cee6c dyld`_main_thread + 172 + rdx = 0x0000000000000000 + rdi = 0x00007fff95d4ebd8 __sFX + 216 + rsi = 0x00000000000120a8 + rbp = 0x00007ffeefbff4f0 + rsp = 0x00007ffeefbff0e8 + r8 = 0x00000000000130a8 + r9 = 0x0000000000000000 + r10 = 0x00007fff95d4ebf8 __sFX + 248 + r11 = 0x00007fff95d4ebf0 __sFX + 240 + r12 = 0x0000000000000000 + r13 = 0x0000000000000000 + r14 = 0x0000000000000000 + r15 = 0x0000000000000000 + rip = 0x0000000100000edb a.out`CG1 + 22 at test.c:10:8 + rflags = 0x0000000000000206 + cs = 0x000000000000002b + fs = 0x0000000000000000 + gs = 0x0000000000000000 + +(lldb) stepi +Process 68542 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + frame #0: 0x0000000100000e9d a.out`CG2 at test.c:3:13 + 1 #include + 2 +-> 3 __code CG2(){ + 4 int i = 10; + 5 printf("i = %d\n", i); + 6 } + 7 +Target 0: (a.out) stopped. +(lldb) bt +* thread #1, queue = 'com.apple.main-thread', stop reason = instruction step into + * frame #0: 0x0000000100000e9d a.out`CG2 at test.c:3:13 + frame #1: 0x0000000100000ef5 a.out`main at test.c:14:8 + frame #2: 0x00007fff6f633cc9 libdyld.dylib`start + 1 +(lldb) register read +General Purpose Registers: + rax = 0x0000000000000000 + rbx = 0x0000000000000000 + rcx = 0x00000001000cee6c dyld`_main_thread + 172 + rdx = 0x0000000000000000 + rdi = 0x00007fff95d4ebd8 __sFX + 216 + rsi = 0x00000000000120a8 + rbp = 0x00007ffeefbff4f0 + rsp = 0x00007ffeefbff0e8 + r8 = 0x00000000000130a8 + r9 = 0x0000000000000000 + r10 = 0x00007fff95d4ebf8 __sFX + 248 + r11 = 0x00007fff95d4ebf0 __sFX + 240 + r12 = 0x0000000000000000 + r13 = 0x0000000000000000 + r14 = 0x0000000000000000 + r15 = 0x0000000000000000 + rip = 0x0000000100000e9d a.out`CG2 at test.c:3:13 + rflags = 0x0000000000000206 + cs = 0x000000000000002b + fs = 0x0000000000000000 + gs = 0x0000000000000000 + +(lldb) exit +Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y +ichikitakahiro % ls +a.out a.out.dSYM test.c test.s tsts +ichikitakahiro % cp test2.c +usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file + cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory +ichikitakahiro % cp test.c test2.c +ichikitakahiro % vim !$ +vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall test2.c +test2.c: In function 'CG1': +test2.c:9:3: internal compiler error: tree check: expected function_type, have function_decl in convert_arguments, at c/c-typeck.c:3662 + 9 | goto CG2(); + | ^~~~ +libbacktrace could not find executable to open +Please submit a full bug report, +with preprocessed source if appropriate. +See for instructions. +ichikitakahiro % vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall test2.c +ichikitakahiro % ./a.out +Hello +i = 20 +ichikitakahiro % vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall test2.c +test2.c: In function 'CG2': +test2.c:5:27: error: expected ';' before '}' token + 5 | printf("str = %s\n",str) + | ^ + | ; + 6 | } + | ~ +test2.c: In function 'CG1': +test2.c:10:16: error: 'Hello' undeclared (first use in this function); did you mean 'ftello'? + 10 | goto CG2(20, Hello); + | ^~~~~ + | ftello +test2.c:10:16: note: each undeclared identifier is reported only once for each function it appears in +test2.c:10:22: error: expected code segment jump or '*' before ';' token + 10 | goto CG2(20, Hello); + | ^ +ichikitakahiro % vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall test2.c +ichikitakahiro % ./a.out +Hello +i = 20 +str = Hello +ichikitakahiro % $CBC_COMPILER -Wall -s test2.c +ld: warning: option -s is obsolete and being ignored +ichikitakahiro % $CBC_COMPILER -Wall -S test2.c +ichikitakahiro % less test2.s +ichikitakahiro % !v +vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall test2.c +ichikitakahiro % ./a.out +Hello +i = 20 +str = 20 +ichikitakahiro % vim test2.c +ichikitakahiro % vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test2.c +ichikitakahiro % lldb a.out +(lldb) target create "a.out" +Current executable set to 'a.out' (x86_64). +(lldb) b CG1 +Breakpoint 1: where = a.out`CG1 + 8 at test2.c:9:3, address = 0x0000000100000eb3 +(lldb) process ra +invalid command 'process ra'. +(lldb) process la +Process 70508 launched: '/Users/ichikitakahiro/workspace/cr/test_space/a.out' (x86_64) +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 + frame #0: 0x0000000100000eb3 a.out`CG1 at test2.c:9:3 + 6 } + 7 + 8 __code CG1(){ +-> 9 printf("Hello\n"); + 10 int i = 10; + 11 goto CG2(20, &i); + 12 } +Target 0: (a.out) stopped. +(lldb) n +Hello +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000ebf a.out`CG1 at test2.c:10:7 + 7 + 8 __code CG1(){ + 9 printf("Hello\n"); +-> 10 int i = 10; + 11 goto CG2(20, &i); + 12 } + 13 +Target 0: (a.out) stopped. +(lldb) +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000ec6 a.out`CG1 at test2.c:11:8 + 8 __code CG1(){ + 9 printf("Hello\n"); + 10 int i = 10; +-> 11 goto CG2(20, &i); + 12 } + 13 + 14 int main(){ +Target 0: (a.out) stopped. +(lldb) p i +(int) $0 = 10 +(lldb) p &i +(int *) $1 = 0x00007ffeefbff0dc +(lldb) p (int*) 0x00007ffeefbff0dc +(int *) $2 = 0x00007ffeefbff0dc +(lldb) p *(int*) 0x00007ffeefbff0dc +(int) $3 = 10 +(lldb) s +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000ed2 a.out`CG1 at test2.c:12:1 + 9 printf("Hello\n"); + 10 int i = 10; + 11 goto CG2(20, &i); +-> 12 } + 13 + 14 int main(){ + 15 goto CG1(); +Target 0: (a.out) stopped. +(lldb) +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000ed3 a.out`CG1 at test2.c:11:8 + 8 __code CG1(){ + 9 printf("Hello\n"); + 10 int i = 10; +-> 11 goto CG2(20, &i); + 12 } + 13 + 14 int main(){ +Target 0: (a.out) stopped. +(lldb) +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000e6a a.out`CG2(i=10, str=0x0000000000000000) at test2.c:3:27 + 1 #include + 2 +-> 3 __code CG2(int i,int* str){ + 4 printf("i = %d\n", i); + 5 printf("str = %d\n",*str); + 6 } + 7 +Target 0: (a.out) stopped. +(lldb) n +Process 70508 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000e79 a.out`CG2(i=20, str=0x00007ffeefbff0dc) at test2.c:4:3 + 1 #include + 2 + 3 __code CG2(int i,int* str){ +-> 4 printf("i = %d\n", i); + 5 printf("str = %d\n",*str); + 6 } + 7 +Target 0: (a.out) stopped. +(lldb) p &i +(int *) $4 = 0x00007ffeefbff0dc +(lldb) exit +Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y +ichikitakahiro % vim test2.c +ichikitakahiro % $CBC_COMPILER -Wall test2.c +ichikitakahiro % $CBC_COMPILER -Wall -O0 -g test2.c +ichikitakahiro % ./a.out +Hello +i = 20 +str = 10 +ichikitakahiro % vim test2.c +ichikitakahiro % lldb a.out +(lldb) target create "a.out" +Current executable set to 'a.out' (x86_64). +(lldb) b CG1 +Breakpoint 1: where = a.out`CG1 + 8 at test2.c:11:3, address = 0x0000000100000e90 +(lldb) process ra +invalid command 'process ra'. +(lldb) process la +Process 71421 launched: '/Users/ichikitakahiro/workspace/cr/test_space/a.out' (x86_64) +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 + frame #0: 0x0000000100000e90 a.out`CG1 at test2.c:11:3 + 8 } + 9 + 10 __code CG1(){ +-> 11 printf("Hello\n"); + 12 // int i = 10; + 13 int* i = malloc(sizeof(int)); + 14 *i = 10; +Target 0: (a.out) stopped. +(lldb) n +Hello +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000e9c a.out`CG1 at test2.c:13:12 + 10 __code CG1(){ + 11 printf("Hello\n"); + 12 // int i = 10; +-> 13 int* i = malloc(sizeof(int)); + 14 *i = 10; + 15 goto CG2(20, i); + 16 } +Target 0: (a.out) stopped. +(lldb) n +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000eaa a.out`CG1 at test2.c:14:6 + 11 printf("Hello\n"); + 12 // int i = 10; + 13 int* i = malloc(sizeof(int)); +-> 14 *i = 10; + 15 goto CG2(20, i); + 16 } + 17 +Target 0: (a.out) stopped. +(lldb) p i +(int *) $0 = 0x0000000100404080 +(lldb) p *i +(int) $1 = 0 +(lldb) n +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000eb4 a.out`CG1 at test2.c:15:8 + 12 // int i = 10; + 13 int* i = malloc(sizeof(int)); + 14 *i = 10; +-> 15 goto CG2(20, i); + 16 } + 17 + 18 int main(){ +Target 0: (a.out) stopped. +(lldb) p *i +(int) $2 = 10 +(lldb) p i +(int *) $3 = 0x0000000100404080 +(lldb) s +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000ec0 a.out`CG1 at test2.c:16:1 + 13 int* i = malloc(sizeof(int)); + 14 *i = 10; + 15 goto CG2(20, i); +-> 16 } + 17 + 18 int main(){ + 19 goto CG1(); +Target 0: (a.out) stopped. +(lldb) s +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000ec1 a.out`CG1 at test2.c:15:8 + 12 // int i = 10; + 13 int* i = malloc(sizeof(int)); + 14 *i = 10; +-> 15 goto CG2(20, i); + 16 } + 17 + 18 int main(){ +Target 0: (a.out) stopped. +(lldb) s +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step in + frame #0: 0x0000000100000e47 a.out`CG2(i=1, str=0x0000000000000000) at test2.c:5:27 + 2 #include + 3 + 4 +-> 5 __code CG2(int i,int* str){ + 6 printf("i = %d\n", i); + 7 printf("str = %d\n",*str); + 8 } +Target 0: (a.out) stopped. +(lldb) n +Process 71421 stopped +* thread #1, queue = 'com.apple.main-thread', stop reason = step over + frame #0: 0x0000000100000e56 a.out`CG2(i=20, str=0x0000000100404080) at test2.c:6:3 + 3 + 4 + 5 __code CG2(int i,int* str){ +-> 6 printf("i = %d\n", i); + 7 printf("str = %d\n",*str); + 8 } + 9 +Target 0: (a.out) stopped. +(lldb) p i +(int) $4 = 20 +(lldb) p &i +(int *) $5 = 0x00007ffeefbff0dc +(lldb) p str +(int *) $6 = 0x0000000100404080 +(lldb) p &str +(int **) $7 = 0x00007ffeefbff0d0 +(lldb) p *str +(int) $8 = 10 +(lldb) exit +Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y +ichikitakahiro % pwd +/Users/ichikitakahiro/workspace/cr/test_space +ichikitakahiro % ls +a.out a.out.dSYM test.c test.s test2.c test2.s tsts +ichikitakahiro % cp test.c test3.c +ichikitakahiro % cat test2.c | pbcopy +ichikitakahiro % ls +a.out test.c test2.c test3.c +a.out.dSYM test.s test2.s tsts +ichikitakahiro % history + 9211 ./a.out + 9212 vim test2.c + 9213 vim test2.c + 9214 $CBC_COMPILER -Wall -O0 -g test2.c + 9215 lldb a.out + 9216 vim test2.c + 9217 $CBC_COMPILER -Wall test2.c + 9218 $CBC_COMPILER -Wall -O0 -g test2.c + 9219 ./a.out + 9220 vim test2.c + 9221 lldb a.out + 9222 pwd + 9223 ls + 9224 cp test.c test3.c + 9225 cat test2.c | pbcopy + 9226 ls +ichikitakahiro % a +