ierg4180 tutorial 4 jim. outline project 1 remarks demo virtual machine programming in ierg4180...

29
IERG4180 Tutorial 4 Jim

Upload: lester-fleming

Post on 21-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

IERG4180 Tutorial 4Jim

Outline• Project 1• remarks• demo

• Virtual Machine• Programming in IERG4180 (Linux)• Coding environment• Compilation• Debugging

2

Remarks on Project 1• Deadline: 11pm, 15th Feb 2015• Submit your work to Blackboard• If you have troubles doing the project, find the tutors as soon

as possible!

3

Demo

4

Outline• Project 1• remarks• demo

• Virtual Machine• Programming in IERG4180 (Linux)• Coding environment• Compilation• Debugging

5

Virtual Machine (VM)• Software based, fictive computer• Multiple OS environments can co-exist using VM which is• Easy to setup• Easy to clean up

• VMware Player• free for non-commercial use

• https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0• VMware Player and VMware Player Plus for Windows (If you are

using Windows as host)

6

VM image for CentOS• Version 6.6• 64 bits• ftp://

ftp.cuhk.edu.hk/pub/Linux/centos/6/isos/x86_64/CentOS-6.6-x86_64-bin-DVD1.iso

• 32 bits• ftp://

ftp.cuhk.edu.hk/pub/Linux/centos/6/isos/i386/CentOS-6.6-i386-bin-DVD1.iso

• If you are not sure, just use the 32 bits• Create a New Virtual Machine > Installer disc image (iso)• Follow the wizard and wait for OS setup

7

VMware Tools• Support better graphics performance, time synchronization,

copy and paste between guest and host, folder sharing, etc.

8

VMware Tools• Extract the VMwareTools-XXXX.tar.gz to desktop• Now there is a folder: vmware-tools-distrib• Run terminal and cd to vmware-tools-distrib• su will grant access for install• vmware-install.pl to install• During installing, click enter to select default options• Restart your virtual machine

9

VMware Tools• To enable folder sharing:

10

VMware Tools• To enable folder sharing:

11

Outline• Project 1• remarks• demo

• Virtual Machine• Programming in IERG4180 (Linux)• Coding environment• Compilation• Debugging

12

Development Tools for CentOS• A Group which includes essential packages like gcc, make• Applications > System Tools > Terminal

• Also, libpcap for packet capturing

13

Compilation• gcc/ g++• -g• debug info

• -lrt• es_timer

• -pthread• <thread>

• -std=c++0x• c++11

14

Compilation• Shell script

• Makefile

15

Debugging• gdb

16

Debugging

17

Debugging• Step out• f

• Step into• s

18

Debugging• Summary

• Credit: http://condor.depaul.edu/glancast/373class/docs/gdb.html

19

Eclipse• An IDE which supports Linux platform• http://www.eclipse.org/downloads/• Eclipse IDE for C/C++ Developers• Linux 32/64 Bit

• Extract the folder after the download• Run eclipse

20

Environment Setup• Install Java Development Kit (JDK)• For Java application development

• Include Java Runtime Environment (JRE) which is required to run Java applications

• Include other things like Java compiler, Java APIs, etc.• http://

www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html• jdk-7u40-linux-i586.rpm/ jdk-7u40-linux-x64.rpm

21

Environment Setup

• Open Eclipse

22

Environment Setup• Create new project

23

Environment Setup• File > New > C++ project

24

Compilation• Run the program• Build the project at first• Run > Run Configurations… to select your application• Remember to apply

25

Debugging• Debug Mode

26

Debugging• Breakpoint • Also has advanced breakpoints like conditional breakpoint

• Step Into/ Step Over/ Step Return• Call Stack

27

Debugging• Variables View

28

About Project 2…• Reuse your work in project 1• Learning objective 1: Code portability• Same piece of source code for Windows and Linux platform

• Learning objective 2: Client Server Model• Multithreading

• Details will be disclosed on next tutorial

29