Click here to Skip to main content
15,926,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Instruction Pointer Pin
Sarath C12-Jun-07 17:39
Sarath C12-Jun-07 17:39 
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 
Hi,

Never. (but depends on the architecture).

if you try this, as steve said,
PFun_t pFun = NULL;	<br />
(*pFun)();

this doesnot set the CS:EIP to NULL.

My argument may depend on software and hardware architecture.

(*pFun)(); will maps to "call <function>" instruction.
And "CALL" instruction internally "JMP"s to the function location.
Hardware exception handling mechanism detects this error for bad location,
jmp $BAD_JMP (jumped out of Code segment(general Protection Fault)) and causes sofware interrupts and in x86 interrupt return mechanism, IRET instruction points to old CS:EIP (exception causing location), for all page faults and general Protection Fault(GPF).

Hence you never caught EIP to NULL while debugging, you will see the EIP will contain the value of the next instruction following the exception occured instruction. However you can detect the BAD JUMP(GPF) caused by NULL function pointer using try.. catch.

You may watch the registers while debugin IDE and also refer documents that may search to "Interrupt and Exception Handling on the x86".

I think most harware and software platform uses Exception handling and CS:EIP never caught with NULL values.

Best Regards
Raj
GeneralRe: Instruction Pointer Pin
Stephen Hewitt12-Jun-07 22:11
Stephen Hewitt12-Jun-07 22:11 
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 

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.