Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Instruction Pointer Pin
tom groezer12-Jun-07 18:02
tom groezer12-Jun-07 18:02 
AnswerRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 18:01
Stephen Hewitt12-Jun-07 18:01 
GeneralRe: Instruction Pointer Pin
tom groezer12-Jun-07 18:08
tom groezer12-Jun-07 18:08 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 18:10
Stephen Hewitt12-Jun-07 18:10 
GeneralRe: Instruction Pointer Pin
Michael Dunn12-Jun-07 18:12
sitebuilderMichael Dunn12-Jun-07 18:12 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 20:54
Stephen Hewitt12-Jun-07 20:54 
AnswerRe: Instruction Pointer Pin
Rajkumar R12-Jun-07 21:43
Rajkumar R12-Jun-07 21:43 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 22:11
Stephen Hewitt12-Jun-07 22:11 
Rajkumar_R wrote:
if you try this, as steve said,
PFun_t pFun = NULL;
(*pFun)();
this doesnot set the CS:EIP to NULL.


Rajkumar_R wrote:
Hence you never caught EIP to NULL while debugging


Run this code:
// CommandLine.cpp : Defines the entry point for the console application.
//
 
#include "StdAfx.h"
#include <windows.h>
 
void main()
{
	typedef void (*PFun_t)(); // Function pointer.
	PFun_t pFun = NULL;	// Set it to NULL.
 
	// Now call through the pointer.
	(*pFun)();
}


The following is what the debugger reports (WinDBG):
(1540.172c): Access violation - code c0000005 (!!! second chance !!!)
eax=cccccccc ebx=7ffd6000 ecx=00000000 edx=00322d08 esi=0012ff30 edi=0012ff80
eip=00000000 esp=0012ff2c ebp=0012ff80 iopl=0         nv up ei pl nz ac pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000216
00000000 ??              ???


EIP is indeed NULL!


Steve

GeneralRe: Instruction Pointer Pin
Rajkumar R12-Jun-07 22:21
Rajkumar R12-Jun-07 22:21 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 22:24
Stephen Hewitt12-Jun-07 22:24 
GeneralRe: Instruction Pointer Pin
Rajkumar R12-Jun-07 22:33
Rajkumar R12-Jun-07 22:33 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 22:40
Stephen Hewitt12-Jun-07 22:40 
GeneralRe: Instruction Pointer Pin
Rajkumar R12-Jun-07 22:50
Rajkumar R12-Jun-07 22:50 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt13-Jun-07 13:19
Stephen Hewitt13-Jun-07 13:19 
AnswerRe: Instruction Pointer Pin
Rajkumar R13-Jun-07 18:51
Rajkumar R13-Jun-07 18:51 
GeneralRe: Instruction Pointer Pin
Stephen Hewitt13-Jun-07 18:54
Stephen Hewitt13-Jun-07 18:54 
AnswerRe: Instruction Pointer Pin
Rajkumar R13-Jun-07 19:50
Rajkumar R13-Jun-07 19:50 
QuestionDebugging Pin
tom groezer12-Jun-07 16:58
tom groezer12-Jun-07 16:58 
AnswerRe: Debugging Pin
Xing Chen12-Jun-07 17:28
Xing Chen12-Jun-07 17:28 
GeneralRe: Debugging Pin
tom groezer12-Jun-07 17:33
tom groezer12-Jun-07 17:33 
GeneralRe: Debugging Pin
Xing Chen12-Jun-07 17:46
Xing Chen12-Jun-07 17:46 
AnswerRe: Debugging Pin
Sarath C12-Jun-07 17:36
Sarath C12-Jun-07 17:36 
QuestionLinks to tutorials Pin
tom groezer12-Jun-07 16:48
tom groezer12-Jun-07 16:48 
AnswerRe: Pointers Pin
Christian Graus12-Jun-07 16:57
protectorChristian Graus12-Jun-07 16:57 
AnswerRe: Links to tutorials Pin
Naveen12-Jun-07 18:00
Naveen12-Jun-07 18:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.