Home > Software engineering >  You consult StackWalk64 use x86 engineering is normal, x64 error
You consult StackWalk64 use x86 engineering is normal, x64 error

Time:10-14

Ask about StackWalk64 use, compile x86 project, the output of the stack is normal, but if the compiler x64 engineering, circulation only conducted a, whether I parameter is wrong? Please god help me, give a solution,
The code is as follows:
 
#include
# include "dbghelp. H"

# pragma comment (lib, "dbghelp. Lib")

Bool ShowStack ()
{
HANDLE h=GetCurrentThread ();
The CONTEXT CONTEXT;
Memset (& amp; The Context, 0, sizeof (Context));
The Context. ContextFlags=(CONTEXT_FULL);
RtlCaptureContext (& amp; The Context);

HANDLE hProcess=GetCurrentProcess ();

DWORD MachineType;
STACKFRAME64 StackFrame;
ZeroMemory (& amp; StackFrame, sizeof (STACKFRAME64));

# ifdef _M_IX86
MachineType=IMAGE_FILE_MACHINE_I386;
StackFrame. AddrPC. Offset=Context. The Eip;
StackFrame. AddrPC. Mode=AddrModeFlat;
StackFrame. AddrFrame. Offset=Context. The Ebp;
StackFrame. AddrFrame. Mode=AddrModeFlat;
StackFrame. AddrStack. Offset=Context. Esp;
StackFrame. AddrStack. Mode=AddrModeFlat;
# elif _M_X64
MachineType=IMAGE_FILE_MACHINE_AMD64;
StackFrame. AddrPC. Offset=Context. Rip;
StackFrame. AddrPC. Mode=AddrModeFlat;
StackFrame. AddrFrame. Offset=Context. Rsp;
StackFrame. AddrFrame. Mode=AddrModeFlat;
StackFrame. AddrStack. Offset=Context. Rsp;
StackFrame. AddrStack. Mode=AddrModeFlat;
# elif _M_IA64
MachineType=IMAGE_FILE_MACHINE_IA64;
StackFrame. AddrPC. Offset=Context. StIIP;
StackFrame. AddrPC. Mode=AddrModeFlat;
StackFrame. AddrFrame. Offset=Context. IntSp;
StackFrame. AddrFrame. Mode=AddrModeFlat;
StackFrame. AddrBStore. Offset=Context. RsBSP;
StackFrame. AddrBStore. Mode=AddrModeFlat;
StackFrame. AddrStack. Offset=Context. IntSp;
StackFrame. AddrStack. Mode=AddrModeFlat;
# the else
# error "Unsupported platform
"# endif


While (StackWalk64 (MachineType, hProcess, GetCurrentThread (), & amp; StackFrame,
& The Context, NULL, SymFunctionTableAccess64 SymGetModuleBase64, NULL))
{
//...
}

return true;
}

CodePudding user response:

Does anyone have this?

CodePudding user response:

Why nobody answer?

CodePudding user response:

From the top, ask ace to help

CodePudding user response:

Computer composition principle and DOS command to assembly language, C language (not including the C + +), code written specification and data structure, compiling principle, operating system and computer network, database principle, the regular expression to other languages (including C + +), architecture...

To learn programming advice:
multi-purpose cerebellum and hand and less in the brain, eyes and mouth, will be faster to learn programming!
Eye over thousand times than hand it again!
Book is better than one thousand lines of hand knock a line!
Hand knock is better than one thousand lines of a single step line!
Single step source code is better than one thousand lines of single-step the Debug version of the corresponding assembly line!
Single step the Debug version of the corresponding assembly is better than one thousand lines of single-step Release version corresponding to the assembly line!

VC debugging when press Alt + 8, Alt + 7, Alt + 6 and Alt + 5, open the assembly window, stack window, memory window and registers the window to see each other C corresponding assembly, single step, and observe the corresponding stack memory and registers changes, this again is not what all understand,
For VC, the so-called 'when debugging is compiled to connect through the later, after press F10 or F11 key step by step, or in a row after press F9 set the breakpoint press F5 execution stops at the breakpoint,

CodePudding user response:

Can consult AfxDumpStack source code

CodePudding user response:

See if the call SymFunctionTableAccess64 SymGetModuleBase64 before there is no call SymInitialize function,
  • Related