20,175,212 Tong Haozhen "Information Security System Design Basics" Week 3 learning summary

20175212 "Information Security System Design Basics" Week 3 learning summary

Learning content summary

A familiar development environment under Linux

Second, be familiar with the basic operation of vi

Third, be familiar with the basic principles of gcc compiler

1. Format GCC [Option] [filename]
-E: compile only preprocessing
-S: converting the assembler source code C
-c: compile only, the connection is not performed
(step above normal compiler)
-o: specify the output file generated
-I: Specifies the header file directory
-I: specifies the program to link the library
-L: Specifies the name of the directory where the file library

Fourth, the skilled use of the common options gcc compiler

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Fifth, skilled use gdb debugging techniques

  • gdb programm (start GDB)
  • b breakpoint (breakpoint to be set up four kinds: line breakpoint, the breakpoint function, conditional breakpoints, a temporary breakpoint)
  • run starts running program
  • bt print function call stack
  • p View variable values
  • c continue to run from the current breakpoint to the next breakpoint
  • Single step n
  • Single step s
  • quit quit GDB

Here Insert Picture Description

Here Insert Picture Description
Here Insert Picture Description

Sixth, be familiar with the basic principles and makefile syntax specification

Source file in a project does not count, according to its type, function modules were placed in several directories, makefile defines a set of rules to specify which files need to be compiled, which files need compiled, which files need to re compilation, even more complex functional operation, because makefile like a script, like Shell, where the operating system commands can be executed. makefile bring the benefits of that - "Automation compilation" Once written, you only need a make command, the whole project is fully automatic compiler, which greatly improves the efficiency of software development.
1.makefile

testmymath: main.o add.o sub.o mul.o div.o 
gcc main.o add.o sub.o mul.o div.o -o testmymath

2. Compile makefile, get the target file testmymath

 testmymath: main.o add.o sub.o mul.o div.o 
    gcc main.o add.o sub.o mul.o div.o -o testmymath
    main.o: main.c head.h
    gcc -c main.c
    add.o: add.c head.h
    gcc -c add.c
    sub.o: sub.c head.h
    gcc -c sub.c
    mul.o: mul.c head.h
    gcc -c mul.c
    div.o: div.c head.h
    gcc -c div.c
    
    

Here Insert Picture Description

Seven, master generation and invoke methods of static and dynamic libraries

Eight, a C program simulation shall be understood that module, the module principle decomposition "high cohesion, low coupling"

Nine, to understand the concept of link

Textbook learning and problem-solving process

  • 问题1:教材中有提到:GDB的n(next)命令让GDB执行下一行,然后暂停。 s(step)命令的作用与此类似,只是在函数调用时step命令会进入函数,那么实际使用中应该优先选用哪个?
  • 问题1解决方案:经过类比以前C和Java的学习得知,应优先使用next。step 就是单步执行,遇到子函数就进入并且继续单步执行;在其他调试其中相当于step-into命令,作用是移动到下一个可执行的代码行。如果当前行是一个函数调用,则调试器进入函数并停止在函数体的第一行。step可以帮助初步揭开代码位置的谜团,例如:函数调用和函数本身可能在不同的文件中。next 是在单步执行时,在函数内遇到子函数时不会进入子函数内单步执行,而是将子函数整个执行完再停止,也就是把子函数整个作为一步。在其他调试器中相当于step-over,作用是在同一个调用栈层中移动到下一个可执行的代码行。调试器不会进入函数体。如果当前行是函数的最后一行,则,next将进入下一个栈层,并在调用函数的下一行停止

代码调试中的问题和解决过程

  • 问题1:提示找不到头文件Here Insert Picture Description

  • 问题1解决方案:之前按教材指导将head.h放在另外创建的include文件夹中,导致直接编译时无法找到。在src中拷贝一份即可编译。

    代码托管

Here Insert Picture Description

上周考试错题总结

其他(感悟、思考等,可选)

xxx
xxx

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 53/53 1/1 20/20

尝试一下记录「计划学习时间」和「实际学习时间」,到期末看看能不能改进自己的计划能力。这个工作学习中很重要,也很有用。
耗时估计的公式
:Y=X+X/N ,Y=X-X/N,训练次数多了,X、Y就接近了。

参考:软件工程软件的估计为什么这么难软件工程 估计方法

  • Plan study time: XX hours

  • The actual study time: XX hours

  • Improvements:

(Available see more modern software engineering courseware
software engineers the ability to self-evaluation form
)

Reference material

Guess you like

Origin www.cnblogs.com/thz666/p/11568977.html