debug in eclipse c++ perspective - university of nicosia · comp 112 software dev. lab i comp 113...
TRANSCRIPT
Comp 111 Programming II Comp 112 Software Dev. Lab I
Comp 113 Programming II Comp 114 Software Dev. Lab II
Debug in Eclipse C++ Perspective Tutorial
Debug in Eclipse C++ Perspective
! This tutorial is for the following environment ! Windows 7 32-bit and 64-bit (only tested on 64-bit) ! Eclipse Juno (4.2) 32-bit version ! MinGW GCC 32-bit version ! Java JDK 7u7 32-bit version (i.e. i586 version)
! Reason for the tutorial ! On the windows platform when you do a step-by-step debug
session of your program using the debug perspective and you have a cin statement, then your session will crash at the cin statement.
! If you follow the steps below then this will not happen.
Copyright © Harald Gjermundrød 2
Changing the Debug Configuration
Copyright © Harald Gjermundrød 3
! Click on Run -> Debug Configurations… Changing the Debug Configuration (Cont.)
Copyright © Harald Gjermundrød 4
! Click on link: select other. . .
Changing the Debug Configuration (Cont.)
Copyright © Harald Gjermundrød 5
! Enable the checkbox: Use configuration specific settings ! Select: Standard Create Process Launcher
Changing the Debug Configuration (Cont.)
Copyright © Harald Gjermundrød 6
! Back in the Debug Configuration dialog do the following ! Select the Debugger tab
Changing the Debug Configuration (Cont.)
Copyright © Harald Gjermundrød 7
! Change the Debugger to: gdb/mi
Changing the Debug Configuration (Cont.)
Copyright © Harald Gjermundrød 8
! For the GDB command set select: Standard ! Then click: Apply
Debug Your Project
Copyright © Harald Gjermundrød 9
! Click on the Debug icon.
Debug Your Project (Cont.)
! If you are asked to change to the Debug Perspective then click Yes for this.
Copyright © Harald Gjermundrød 10
Debug Your Project (Cont.) ! You now got a
CMD window (the black one) this is where you will see the output and enter the input to the program
! From the menu bar, you can now select: ! Continue to Run ! Stop ! Step Into ! Step Over
Copyright © Harald Gjermundrød 11
Debug Your Project (Cont.)
Copyright © Harald Gjermundrød 12
! If you click on “step over” until you have reached a cin statement, then you switch to the CMD window and enter the data there
Debug Your Project (Cont.)
! While you debug the project (step-by-step), then you can also view the values of the variables
Copyright © Harald Gjermundrød 13