X hits on this document

296 views

0 shares

0 downloads

0 comments

41 / 120

engineer, such as the count and type of parameters one must pass to a given method. An

obvious recommendation to make here, assuming there is an interest in protecting

machine code from being reverse engineered, is to ensure that source code is not

compiled for debugging when generating machine code for use by customers.

Table 7.1. Debugging information inserted into machine code.

08:

cout << "Enter function [+|-|*]: ";

09:

getline(cin, input); fnc = input.at(0);

10:

switch (fnc)

11:

{

18:

}

19:

cout << "Result: " << res << endl;

20:

return 0;

Calculator.cpp:

01: int main(int argc, char *argv[]) 02: {

res = doAdd(op1, op2); case '-':

break;

res = doSub(op1, op2); case '*':

break;

res = doMul(op1, op2);

break;

03: 04: 05: 06: 07:

string input; int op1, op2; char fnc; long res; cout << "Enter integer 1: "; getline(cin, input); op1 = atoi(input.c str()); cout << "Enter integer 2: "; getline(cin, input); op2 = atoi(input.c str()); _

_

} } }

21:

}

22: long doAdd(int op1, int op2) 23: long doSub(int op1, int op2) 24: long doMul(int op1, int op2)

{ return op1 + op2; { return op1 - op2; { return op1 * op2;

12: 13: 14: 15: 16: 17:

case '+':

01:

.file

"Calculator.cpp"

02:

.stabs

"C:/SRECD/MiscCPPSource/Calculator/",100,0,0,Ltext0

03:

.stabs

"Calculator.cpp",100,0,0,Ltext0

04:

.stabs

"main:F(0,3)",36,0,12,_main

05:

.stabs

"argc:p(0,3)",160,0,12,8

06:

.stabs

"argv:p(40,35)",160,0,12,12

08:

call

__Z5doAddii

09:

call

__Z5doSubii

10:

call

__Z5doMulii

Calculator.s (abbreviated assembly):

"Calculator.cpp",132,0,0,Ltext

:

06:

main

07:

__ .stabs

33

Document info
Document views296
Page views297
Page last viewedFri Oct 28 22:06:55 UTC 2016
Pages120
Paragraphs2913
Words25794

Comments