Script started on Fri 22 Jan 2016 11:04:57 AM EST
ppannuto@C4CS-W16-patbook:~
$ $ # 11:00 http://tinyurl.com/zb4rapm
ppannuto@C4CS-W16-patbook:~
$ $ how about now?cdpannuto@C4CS-W16-patbook:~
$ cd lec3/
ppannuto@C4CS-W16-patbook:~/lec3
$ ls
math.c
ppannuto@C4CS-W16-patbook:~/lec3
$ vi math.c
th.c" 5L, 59C 1 #include <stdio.h>
2
3 int main() {
4 "2+2=%d\n", 4);
5 }
~ ath.c (~/lec3) - VIMath.cppannuto@C4CS-W16-patbook:~/lec3
$ gcc math.c
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ objdump -Sd a.out | less
=
a.out: file format elf64-x86-64
Disassembly of section .init:
00000000004003e0 <_init>:
4003e0: 48 83 ec 08 sub $0x8,%rsp
4003e4: 48 8b 05 0d 0c 20 00 mov 0x200c0d(%rip),%rax # 600ff8 <_D :/mmaaiinn1H
at elf64-x86-64
1H
1H
bly of section .init:
1H
1H00000000004003e0 <_init>:
1H 4003e0: 48 83 ec 08 sub $0x8,%rsp
ov 0x200c0d(%rip),%rax # 600ff8 <_D 1H1H
at elf64-x86-64
1H
1H
bly of section .init:
1H
1H00000000004003e0 <_init>:
1H 4003e0: 48 83 ec 08 sub $0x8,%rsp
ov 0x200c0d(%rip),%rax # 600ff8 <_D 1H...skipping...
0000000000400420 <__libc_start_main@plt>:
400420: ff 25 fa 0b 20 00 jmpq *0x200bfa(%rip) # 601020 <_GLOBA L_OFFSET_TABLE_+0x20>
400426: 68 01 00 00 00 pushq $0x1
40042b: e9 d0 ff ff ff jmpq 400400 <_init+0x20>
0000000000400430 <__gmon_start__@plt>:
400430: ff 25 f2 0b 20 00 jmpq *0x200bf2(%rip) # 601028 <_GLOBA L_OFFSET_TABLE_+0x28>
:
400464: e8 b7 ff ff ff callq 400420 <__libc_start_main@plt>
400469: f4 hlt
40046a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
0000000000400470 <deregister_tm_clones>:
400470: b8 47 10 60 00 mov $0x601047,%eax
400475: 55 push %rbp
400476: 48 2d 40 10 60 00 sub $0x601040,%rax
40047c: 48 83 f8 0e cmp $0xe,%rax
:
0000000000400536 <main>:
400536: 55 push %rbp
400537: 48 89 e5 mov %rsp,%rbp
40053a: be 04 00 00 00 mov $0x4,%esi
40053f: bf e4 05 40 00 mov $0x4005e4,%edi
400544: b8 00 00 00 00 mov $0x0,%eax
400549: e8 c2 fe ff ff callq 400410 <printf@plt>
40054e: b8 00 00 00 00 mov $0x0,%eax
400553: 5d pop %rbp
:
$ cat math.c
#include <stdio.h>
int main() {
printf("2+2=%d\n", 4);
}
ppannuto@C4CS-W16-patbook:~/lec3
$ hexedit math.c
=00000000 23 69 6E 63 6C 75 64 65 20 3C 73 74 64 69 6F 2E #include <stdio.
00000010 68 3E 0A 0A 69 6E 74 20 6D 61 69 6E 28 29 20 7B h>..int main() {
00000020 0A 09 70 72 69 6E 74 66 28 22 32 2B 32 3D 25 64 ..printf("2+2=%d
00000030 5C 6E 22 2C 20 34 29 3B 0A 7D 0A64H\n", 4);.}.
00000040
00000050
00000060
00000070
00000080
--- math.cppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ ed atmath.c
59
ahel yeo0 help
?
Help
?
?
?
quit
?
go waw away
stop
?
^C
?
q
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ ed -p"> " math.c
59
> ppannuto@C4CS-W16-patbook:~/lec3
$ cath mat math.c h
#include <stdio.h>
int main() {
printf("2+2=%d\n", 4);
}
cat: h: No such file or directory
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ cat math.c h
#include <stdio.h>
int main() {
printf("2+2=%d\n", 4);
}
ppannuto@C4CS-W16-patbook:~/lec3
$ $ pannuto@C4CS-W16-patbook:~/lec3
$ cat math.c
#include <stdio.h>
int main() {
printf("2+2=%d\n", 5);
printf("That's not how math works\n");
}
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ vi math.c t
th.c" 6L, 99C 1 #include <stdio.h>
2
3 int main() {
4 "2+2=%d\n", 5);
5 "That's not how math works\n");
6 }
~ ath.c (~/lec3) - VIMath.c{~ ath.c + (~/lec3) - VIMath.c(4ath.c" 5L, 59C written
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ $ cat math.c
#include <stdio.h>
int main() {
printf("2+2=%d\n", 4);
}
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ ed math.c
59
.
}
,p
#include <stdio.h>
int main() {
printf("2+2=%d\n", 4);
}
-
printf("2+2=%d\n", 4);
s/4/5/ 2/5
printf("5+2=%d\n", 4);
^[[A s/ u
.
printf("2+2=%d\n", 4);
s/2/4/g
.
printf("4+4=%d\n", 4);
s/4.4/8
printf("8=%d\n", 4);
. s/[a=z a-z]/HELLO/
.
HELLOrintf("8=%d\n", 4);
^[[A^[[A s/[a= -z]*/printf
printf HELLOrintf("8=%d\n", 4);
.
printf HELLOrintf("8=%d\n", 4);
s/printf/cout
cout HELLOrintf("8=%d\n", 4);
.
cout HELLOrintf("8=%d\n", 4);
q
?
q
ppannuto@C4CS-W16-patbook:~/lec3
$ pannuto@C4CS-W16-patbook:~/lec3
$ NEW TEX$ N#echo "
> ENEW TEXT
>
> EDITING TEXT
>
> THINKING
> > bash: unexpected EOF while looking for matching `"'
bash: syntax error: unexpected end of file
ppannuto@C4CS-W16-patbook:~/lec3
$ exit
Script done on Fri 22 Jan 2016 02:12:27 PM EST