2019-2020-1 20175325 "Information Security System Design Basics," the first week of learning summary

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+选项+文件名

-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
  • 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
  • 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!
  • 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 program
    • bt Print function call stack
    • p View variable values
    • c Continue to run from the current breakpoint to the next breakpoint
    • n Single-step operation
    • s Single-step operation
    • quit Out of GDB
    • 大写“K"It can be used to find help functions: View man 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)
listcode is displayed with the line
start+cotinue=runrunning
s+c=r
watch bvalue of the observed variable b, the program is stopped when the change
sinto the internal function
nstep through
quitexit gdb
info bview breakpoint information save and
save breakpoint fig.dpsave the break point in the fig.dp
gdb hello2 -x fig.dpread 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
  • 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

Guess you like

Origin www.cnblogs.com/sgm5/p/11568696.html