2019-2020-1 20175325 "Information Security System Design Basics," the first week of learning summary
First, the table of contents:
- Learning Content
- Code debugging and problem solving in the process
- Impressions
- PSP
Second, the learning content:
- Computer: Hardware + Software
- The system was hardware components:
- Bus, and for carrying information bytes in each transfer member
- I / O devices, systems and the outside world contact channel
- Main memory: a temporary storage device for storing the data processing program
- Processor: Cunshu engine that interprets and executes instructions in main memory
- The compiler gcc:
- Format:
gcc+选项+文件名
- Format:
-E: performed only preprocessor
-S: The C code into assembly code
-c: only the compilation operation, without linking
-o: specifies the output file generation
-I: header file directory specified
-l: Specifies the link PROCEDURES the library
-L: Specifies the name of the directory where the file library
- Compilation process:
- Pretreatment:
gcc -E hello.c -o hello.i
- compilation:
gcc -S hello.i -o hello.s
- Assembly:
gcc -c hello.s -o hello.o
Note : vim garbled when viewing hello.o, commonobjdump -d hello.o
- link:
gcc hello.o -o hello
- Pretreatment:
- Compile
- The source files compiled with:
gcc test_a.c text_b.c -o test / gcc *.c -o test
- Various source files are then compiled links:
gcc -c test_a.c
gcc -c test_b.c
gcc -o test_a.o test_b.o -o test
- The source files compiled with:
- About vim:
- Open: vim [filename]
- Press i will enter insert mode, you can edit the code
- Press Esc will enter the normal mode
- Use keyboard shortcuts for editing, editing is:
h Move cursor left
l Move cursor right
j move cursor down
k move cursor
w to move to the next word
- vim exit and save
- Save and
:wq+回车键
Exit: ,Esc+Shift+zz
- Exit without saving:
Esc+q!
- Save and
- GDB basic commands
gdb programm
(Start GDB)- b set breakpoints: breakpoint to be set up four kinds: line breakpoint, the breakpoint function, conditional breakpoints, breakpoint temporary
run
Start the programbt
Print function call stackp
View variable valuesc
Continue to run from the current breakpoint to the next breakpointn
Single-step operations
Single-step operationquit
Out of GDB大写“K
"It can be used to find help functions: Viewman page
, command mode, the cursor on the function name, press the" K "can directly look at man page.- Breakpoint debugging:
break x
(X indicates a position to set a breakpoint line number)
delete x
(x denotes removing breakpoints line number)
list
code is displayed with the line
start+cotinue=run
running
s+c=r
watch b
value of the observed variable b, the program is stopped when the change
s
into the internal function
n
step through
quit
exit gdb
info b
view breakpoint information save and
save breakpoint fig.dp
save the break point in the fig.dp
gdb hello2 -x fig.dp
read the saved file breakpoint debugging
- The format of the Makefile:
vim Makefile
- Add clear command (clean) Makefile file, such as:
.DCT:clean
Clean: delete all files of type .o
- Add clear command (clean) Makefile file, such as:
rm –rf *.o
Compile and execute (make: compilation, ./all: execution)
Third, the problem of debugging the code and resolution
- The question: do the test, it does not set a breakpoint with GDB
- Solution: In reference commonly used gdb debugger breakpoints summary, learning the (condition) setting breakpoints and saving, as well as some simple GDB command.
- Second problem: GDB debugging problems have been reading the symbol table, use the "file" command "
- Solution: at compile time, not added -g option, resulting in no debugging symbols.
Four thoughts:
early learning, because the uppercase i (I), and lowercase L (l) often could not tell, resulting in a lot of compilation errors, wasted some time, and more familiar with the gcc-related instruction, they will avoid this problem by using the blue Devils cloud video learning that he can not understand the point of knowledge repeated viewing, but there are some less able to grasp the knowledge points, the need to consolidate.
Five, PSP:
------ | The number of lines of code | Blog quantity | study-time |
---|---|---|---|
aims | 5000 | 25 | 400 hours |
the first week | 63/63 | 1 | 7 |