National embedded Talent Training Base
1. function callPrevious PageChapter 2 Relationship Between assembly and CNext Page
--------------------------------------------------------------------------------
1. Please comment on function calls
We use the following code to study the function call process.Example 19.1: Study the function call ProcessInt bar (int c, int D)
{
Int e = C + D;
Return E;
}
Int Foo (int A, int B)
{
Return bar (A, B );
}
Int main (void)
{
Foo (2, 3 );
Return 0;
}
If the-G
"
Ref = 2;
Int* P = I;
Cout "Ref ="", I ="
}
Use the above CodeG ++ test. cCompile and decompileObjdump-d a. OutTo obtain the assembly code of the main function:
08048714 8048714: 55 push % EBP 8048715: 89 E5 mov % ESP, % EBP 8048717: 83 E4 F0 and $0xfffffff0, % ESP// Reserved location for the parameters argc and argv of the Main Function 80100001a: 56 push % ESI 801
of viewAPI: interface between programmer and computerABI: Program and CPU binary interface, instruction encoding, mainly assembly instructions, need to be familiar with the instructions involved in the register layout, most instructions can access memory.The EIP in X86 automatically adds an instruction after the CPU executes an instruction, the instruction length is different, and can be modified by other instructions such as CALL,RET,JMP and conditional JMP.Ii. the basis of x86 compilationStac
Program Description: Output multi-line content, the content is as follows:*************************1#include 2 using namespacestd;3 intMain ()4 {5cout " *"Endl;6cout " ***"Endl;7cout " *****"Endl;8cout "*******"Endl;9cout " *****"Endl;Tencout " ***"Endl; Onecout " *"Endl; A -System"Pause"); - return 0; the}Debug Disassembly CodeintMain () {00ff5e00 push ebp //Enter function after the first thing, save the bottom pointer, used to exit the function to restore the bottom of the stack. 00
change the point. 4. Implementation of pointers and references
We use the following simple code to drill down on pointers and references:
#include
using namespace Std;
int main (int argc, char** argv)
{
int i=1;
int ref=i;
int x=ref;
cout
ref=2;
int* p=i;
cout
}
The code above is compiled with g++ test.c and then disassembled objdump-d a.outto get a section of the assembly code for the main function as follows:
08048714 8048714:55 Push%EBP8048715:89 e5 mov%
reference itself and the sky is the constant, that is, can not change the point.4. Implementation of pointers and referencesWe use the following simple code to drill down on pointers and references:#include using namespace Std;int main (int argc, char** argv){int i=1;int ref=i;int x=ref;coutref=2;int* p=i;cout}The above code is compiled with g++ test.c , and then disassembled objdump-d a.out, to get the assembly code of the main function as follows:
08048714 8048714:55 P
Brief introductionView Baidu Search 中文文本聚类 I am disappointed to find that there is no complete online on the python implementation of the Chinese text clustering (and even search keywords python 中文文本聚类 are so), the Internet is mostly about the text clustering Kmeans 原理 , Java实现 R语言实现 ,, There's even one C++的实现 .I wrote some of the articles, I did not very good classification, I would like to be able to cluster the method of some similar articles to cluster, and then I look at each cluster of the
as the preceding type description.Then go back to the previous example, X is a two-dimensional array of definitions, p is an array pointer to an array of length 4, one to the first line of X (the line of x is an int array of length 4) and the next for loop, then the p+1 value, plus K (actually 1) and then the value, and add it to the variable N. The loop performs a total of 2 times, taking the first element (i.e. x[0][1],x[1][1]) of line 1th and line 2nd (corresponding to the first subscript 0
linguistic term that is synonymous with stemming (stemming), which can be called word-of-word reduction , which is to restore "drove" to "drive" by querying the dictionary.And stemming will shorten the word, "apples", "apple" after processing has become "APPL"
Wikipedia introduction to Word-of-word reduction
European languages Lemmatizer A C-language Lib
Do computer language study will involve lemmatization, I personally think do search completely can not consider, stemming al
.
Mov a and B send the value of B to a, and regard it as a value assignment statement in programming, that is, B is assigned to a. Then the value of a is B.
Nop does not work, that is, nothing is done.
Retn retrieves the return address from the stack and jumps to the address for execution.
Here are some arithmetic operation commands:
ADD Addition
Sub Subtraction
Inc plus 1
Dec minus 1
Finally, the jump command:
Jmp unconditional jump
Je or jz jump if equal
Skip if not equal to jne or jnz
Skip if
To simplify the problem, analyze the compilation code generated by the simplest c code:# Vi test1.c
Int main (){Return 0;}
Compile the program to generate a binary file:# Gcc test1.c-o test1# File test1Test1: ELF 32-bit LSB executable 80386 Version 1, dynamically linked, not stripped
Test1 is an executable file in the ELF format of 32-bit Little Endian. It is dynamically linked and the symbol table is not removed.
This is a typical executable file format on the Unix/Linux platform.
With mdb dis
In C + +, when a class contains a virtual function, the class has polymorphism. An important function of the constructor is to initialize the vptr pointer, which is a critical step to ensure polymorphism.
Constructor initializes the vptr pointer
The following is the C + + Source:
Class X {
private:
int i;
Public:
X (int ii) {
i = II
}
virtual void set (int II) {//virtual function
i = II;
}
};
int main () {
x x (1);
}
The following is the corresponding main
based on the operand size to generate assembly code. At the Assembly language level, this set of General registers is referenced with % e (ATT syntax) or directly starting with e (Intel syntax), such as mov $5, % eax or mov eax, 5: Assign the value of "Number 5" to register % eax. In x86 processors, the EIP (Instruction Pointer) is the Instruction register pointing to the Instruction address (offset in the code segment) waiting for execution under the processor ), the EIP value of each Assembly
1.Feature extractors (feature extraction)
1.1 TF-IDF
Word frequency (term Frequency)-reverse document frequencies (inverse documents Frequency) is a feature vectorization method that is widely used in text mining to assess the importance of a term to one file set or one document in a corpus. Definition: T is represented by a word, D represents a document, D represents a corpus of multiple documents (corpus), and Word frequency TF (t,d) indicates how
courseware has pointed out: sending a username that exceeds 480 bytes to the server can trigger the vulnerability (that is, using the command USER longString \ r \ n). After overflow, the content in ESP contains part of longString. Verification and analysis are required.2.2 analyze the stack structure of war-ftp v1.65, that is, the exact location of EIP, ESP, and ebp in the analysis stack.2.3 construct exp
add eax,0x8; Pptr+2 003cc57c; In C language, the operation of pointers is 003cc57c based on pointer type; An int pointer plus 1 means that the address it points to is moved backward in length to a 003cc57c; The distance of the int size, which is 4 bytes. If it's a word type, move backwards by 2 bytes. 003cc57f Push eax003cc580 mov ecx,[local.7]003cc583 add ecx,0x4; Pptr+1 003cc586 push ecx003cc587 mov edx,[local.7]003cc58a push edx; pptr+0 003cc58b push 9-44.00420c6c; ASCII "%x%x%x\r\n" 0
We can encapsulate everything that a single task uses in a LDT, which is the embryonic form of multitasking.The types of segments used by multitasking are shown below, and the method of using LDT to isolate each application task is one of the key protection requirements:
Process schematic:
We need a data structure to record the state of a process, the process information is written to the data structure when the process is to be suspended, and the information is read again when the process resta
Address: http://www.cppblog.com/liu1061/articles/53762.html
If you are on a Linux platform, you can use GDB for disassembly and debugging. (Transfer)
2. The simplest CCodeAnalysis
To simplify the problem, analyze the compilation code generated by the simplest C code:# Vi test1.cInt main (){Return 0;}CompileProgramTo generate binary files:# GCC test1.c-O test1# File test1Test1: Elf 32-bit LSB executable 80386 version 1, dynamically linked, not stripped
Test1 is an executable file in the EL
Next we will take the release version as an example to illustrate the anatomy.
The key code for the EXE disassembly is as follows:
Function showcomputername:00401030: 8B 4C 24 04 mov ECx, dword ptr [esp + 4]
00401034: 83 EC 0C sub ESP, 0ch
00401037: 8d 44 24 00 Lea eax, [esp]
0040103b: 50 push eax
0040103c: 51 push ECx
0040103d: E8 be FF call 00401000
00401042: 8
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.