Click here to Skip to main content
14,663,599 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to print all source code what was running? Pin
Stefan_Lang28-Jan-19 0:42
mveStefan_Lang28-Jan-19 0:42 
QuestionRe: How to print all source code what was running? Pin
David Crow25-Jan-19 4:44
MemberDavid Crow25-Jan-19 4:44 
AnswerRe: How to print all source code what was running? Pin
k505425-Jan-19 6:31
mvek505425-Jan-19 6:31 
QuestionRe: How to print all source code what was running? Pin
David Crow25-Jan-19 6:46
MemberDavid Crow25-Jan-19 6:46 
GeneralRe: How to print all source code what was running? Pin
Member 1308136925-Jan-19 13:51
MemberMember 1308136925-Jan-19 13:51 
GeneralRe: How to print all source code what was running? Pin
Stefan_Lang28-Jan-19 0:52
mveStefan_Lang28-Jan-19 0:52 
AnswerRe: How to print all source code what was running? Pin
Member 1308136925-Jan-19 13:43
MemberMember 1308136925-Jan-19 13:43 
AnswerRe: How to print all source code what was running? Pin
Randor 25-Jan-19 13:51
professional Randor 25-Jan-19 13:51 
Hi,

You could use the Debug Interface Access SDK to get the exact line of 'source code' associated with any instruction offset in the executable. This is how WinDbg and Visual Studio knows where the line of source code is located.

Using your sample:
main()
{
  int iTemp = 0; __asm int 3;
  fun(); __asm int 3;
  iTemp = 1; __asm int 3;
}

Then add an exception hander for STATUS_BREAKPOINT (0x80000003) and call into DIA and pass the exception offset to get the source line.

It's actually quite simple.

However if you are looking to perform instrumentation at the instruction level then have a look at DynamoRIO and specifically the instrace_x86 sample.

Best Wishes,
-David Delaune
GeneralRe: How to print all source code what was running? Pin
Member 1308136926-Jan-19 12:53
MemberMember 1308136926-Jan-19 12:53 
GeneralRe: How to print all source code what was running? Pin
Randor 26-Jan-19 15:43
professional Randor 26-Jan-19 15:43 
GeneralRe: How to print all source code what was running? Pin
Member 1308136926-Jan-19 22:40
MemberMember 1308136926-Jan-19 22:40 
GeneralRe: How to print all source code what was running? Pin
Randor 28-Jan-19 4:30
professional Randor 28-Jan-19 4:30 
GeneralRe: How to print all source code what was running? Pin
Member 1308136930-Jan-19 12:22
MemberMember 1308136930-Jan-19 12:22 
GeneralRe: How to print all source code what was running? Pin
Stefan_Lang28-Jan-19 1:32
mveStefan_Lang28-Jan-19 1:32 
GeneralRe: How to print all source code what was running? Pin
Randor 28-Jan-19 4:13
professional Randor 28-Jan-19 4:13 
GeneralRe: How to print all source code what was running? Pin
Stefan_Lang28-Jan-19 21:12
mveStefan_Lang28-Jan-19 21:12 
AnswerRe: How to print all source code what was running? Pin
Victor Nijegorodov26-Jan-19 5:26
MemberVictor Nijegorodov26-Jan-19 5:26 
GeneralRe: How to print all source code what was running? Pin
Member 1308136926-Jan-19 12:05
MemberMember 1308136926-Jan-19 12:05 
GeneralRe: How to print all source code what was running? Pin
Victor Nijegorodov27-Jan-19 0:02
MemberVictor Nijegorodov27-Jan-19 0:02 
GeneralRe: How to print all source code what was running? Pin
Member 1308136928-Jan-19 1:38
MemberMember 1308136928-Jan-19 1:38 
GeneralRe: How to print all source code what was running? Pin
Victor Nijegorodov28-Jan-19 1:51
MemberVictor Nijegorodov28-Jan-19 1:51 
AnswerRe: How to print all source code what was running? Pin
Stefan_Lang28-Jan-19 1:46
mveStefan_Lang28-Jan-19 1:46 
QuestionHow to change the background color of checkbox in CListCtrl? Pin
manoharbalu23-Jan-19 19:05
Membermanoharbalu23-Jan-19 19:05 
SuggestionRe: How to change the background color of checkbox in CListCtrl? Pin
Richard MacCutchan23-Jan-19 22:37
mveRichard MacCutchan23-Jan-19 22:37 
GeneralRe: How to change the background color of checkbox in CListCtrl? Pin
manoharbalu24-Jan-19 1:35
Membermanoharbalu24-Jan-19 1:35 

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.