SimGUI Overview

Download Report

Transcript SimGUI Overview

Introduction to Runtime Debugging Using the
Visual C++ IDE
COP 4331: OO Processes for SW Development
© Dr. David A. Workman
Mike Barnoske
School of EE and Computer Science
Last Updated : January 29, 2008
Jan. 29, 2008
(c) Mike Barnoske
Introduction to Visual C++
Recent Releases
Name
Version
Date
Visual C++ 6
6.0
1998
Visual C++ .NET 2002
7.0
2002
Visual C++ .NET 2003
7.1
2003
Visual C++ 2005
8.0
2005
Visual C++ 2008 (Beta 2)
?
July 2007
Current Versions
Visual Studio 2005 Standard
Visual Studio 2005 Professional
Visual Studio C++ 2005 Express Edition
Jan. 29, 2008
(c) Mike Barnoske
Visual C++ 2005 Express Edition Layout
Jan. 29, 2008
(c) Mike Barnoske
Visual C++ 2005 Express Edition Layout
• Editor
• Solution / Project
Browser
• Class Browser
• Output Window
• Call Browser
• Debug Windows
Jan. 29, 2008
(c) Mike Barnoske
Getting Started in
Visual C++ 2005 Express Edition
•
File->New->New Project (Shift+Control+N)
• Win32 Tab, Win32 Console Application
• Application Settings, Console Application, Empty Project
•
Source Files Folder (In Project Browser)
• Add-New Item
• Code Tab, C++ Source File (.cpp)
•
Add code to the Source File
•
To Compile:
• F7 or Build->Build %ProjectName%
•
To Run in the IDE:
• Ctrl+F5 or Debug->Start Without Debugging
Jan. 29, 2008
(c) Mike Barnoske
Files Used By Visual C++
Name
Description
Details
$(SolutionName).sln
Solution
Contains List of Projects
$(SolutionName).suo
Solution
User Options
Windows Open, Window and
Cursor Location, Breakpoints
$(SolutionName).ncb
Intellisense
Database
AutoComplete Information
$(ProjectName).vcproj
Project
Makefile-like, The .h/.cpp File
List, Project Options
$(ProjectName)XXX.user
Project User
Options
User-Specific/Machine-Specific
Project Options
Debug\
$(ProjectName).exe
Executable
Debug\
$(ProjectName).pcb
Debug
Information
Jan. 29, 2008
Maps Source Files to
Executable for Debugging
(c) Mike Barnoske
Debug Information
main.cpp
factorial.pdb
factorial.exe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Function int main 0x00001000
Param none
Local a
Type int
Address 0x00001000
Source File main.cpp
Line 14 0x00001000
Line 15 0x00001004
Line 16 0x00001010
Line 17 0x0000104C
.
.
.
0x1000
0x1004
0x1008
0x100C
0x1010
0x1014
.
.
.
0x104C
.
.
.
0x1100
0x1104
0x1108
0x110C
0x1110
0x1114
0x1118
.
.
.
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
// main.cpp
#include <iostream>
using namespace std;
int f( int v )
{
if (v == 0)
return 1;
return v * f( v – 1 );
}
int main( void )
{
int a = 3;
cout << f( a ) << endl;
return 0;
}
Jan. 29, 2008
Function int f 0x00001100
Param v
Type int
Address 0x00001100
Source File main.cpp
Line 7 0x00001100
Line 8 0x00001104
Line 9 0x00001108
Line 10 0x00001118
(c) Mike Barnoske
:
:
:
:
:
:
00
AB
23
AB
23
AB
00
CD
45
CD
45
CD
00
EF
67
EF
67
EF
00
01
89
01
89
01
: 45 67 89 AB
:
:
:
:
:
:
:
00
CC
22
66
AB
BC
11
00
DD
33
77
CD
AB
22
00
EE
44
88
EF
9A
34
00
FF
55
11
AB
89
56
Hotkeys for Visual C++ Debugging
Name
Details
F5
Start (Debugging), Continue
F9
Toggle Breakpoint
F10
Step Over
F11
Step Into
Shift+F5
Stop Debugging, End Program
Jan. 29, 2008
(c) Mike Barnoske
Web Resources for Visual C++ Debugging
•
Video Tutorial : Getting Started with Visual C++ 2005 Express Edition
http://msdn2.microsoft.com/en-us/visualc/bb530677.aspx
•
MSDN (Debugging in Visual Studio)
http://msdn2.microsoft.com/enus/library/sc65sadd(VS.80).aspx
•
Debug Info
http://www.debuginfo.com/articles/gendebuginfo.html
Jan. 29, 2008
(c) Mike Barnoske