Hi,
I've been attempting to use StackWalk64 on IA64. Unfortunately, the
Microsoft docs seem to be rather vague as to what is required. My test
program works on the I386, but won't not on the IA64.
On the IA64 the StackWalk64 returns true, so the call thinks it
succeeded. But the resulting StackFrame64 does not have correct data,
and further calls to StackWalk64 return false.
Has anybody gotten this to work that might be able to provide me
with some pointers as to what I am doing wrong? My code is posted
below. I've tried lots of different code hacks to get this to work,
but nothing is helping. I suspect that the thread context is what is
throwing me off, but I've exhausted my leads to track this down.
Thanks,
John
void StackTrace()
{
int success = 0;
HANDLE hThread = GetCurrentThread();
HANDLE hProcess = GetCurrentProcess();
CONTEXT context;
memset (&context, 0, sizeof(context));
context.ContextFlags = CONTEXT_CONTROL;
success = GetThreadContext(hThread, &context);
STACKFRAME64 stackFrame;
memset (&stackFrame, 0, sizeof(stackFrame));
stackFrame.AddrPC.Offset = context.StIIP;
stackFrame.AddrPC.Mode = AddrModeFlat;
stackFrame.AddrStack.Offset = context.IntSp;
stackFrame.AddrStack.Mode = AddrModeFlat;
stackFrame.AddrBStore.Offset = context.RsBSP;
stackFrame.AddrBStore.Mode = AddrModeFlat;
DWORD machineType = IMAGE_FILE_MACHINE_IA64;
while (success)
{
success = StackWalk64(machineType, hProcess, hThread,
&stackFrame, &context, NULL, NULL, NULL, NULL);
printf ("%#08x, %#08x\n", (unsigned int)stackFrame.AddrReturn.Offset,
(unsigned int)stackFrame.AddrPC.Offset);
}
} 3 2629
Change your test program so that it raises an exception and gets the thread
context from the exception information.
CONTEXT context;
char *p = 0;
__try
{
*p = 0; // or create your own exception and Raise() it.
}
__except(CopyMemory(&context, (GetExceptionInformation())->ContextRecord,
sizeof(context)), EXCEPTION_EXECUTE_HANDLER)
{
// run your traceback. But..
// DONT set any initial values in the STACKFRAME64. Let him figure it out
from the context. It works for me.
}
"John Riggs" <j_*******@hotmail.com> wrote in message
news:4f**************************@posting.google.c om... Hi, I've been attempting to use StackWalk64 on IA64. Unfortunately, the Microsoft docs seem to be rather vague as to what is required. My test program works on the I386, but won't not on the IA64. On the IA64 the StackWalk64 returns true, so the call thinks it succeeded. But the resulting StackFrame64 does not have correct data, and further calls to StackWalk64 return false. Has anybody gotten this to work that might be able to provide me with some pointers as to what I am doing wrong? My code is posted below. I've tried lots of different code hacks to get this to work, but nothing is helping. I suspect that the thread context is what is throwing me off, but I've exhausted my leads to track this down.
Thanks, John
void StackTrace() { int success = 0; HANDLE hThread = GetCurrentThread(); HANDLE hProcess = GetCurrentProcess();
CONTEXT context; memset (&context, 0, sizeof(context)); context.ContextFlags = CONTEXT_CONTROL; success = GetThreadContext(hThread, &context);
STACKFRAME64 stackFrame; memset (&stackFrame, 0, sizeof(stackFrame));
stackFrame.AddrPC.Offset = context.StIIP; stackFrame.AddrPC.Mode = AddrModeFlat; stackFrame.AddrStack.Offset = context.IntSp; stackFrame.AddrStack.Mode = AddrModeFlat; stackFrame.AddrBStore.Offset = context.RsBSP; stackFrame.AddrBStore.Mode = AddrModeFlat; DWORD machineType = IMAGE_FILE_MACHINE_IA64;
while (success) { success = StackWalk64(machineType, hProcess, hThread, &stackFrame, &context, NULL, NULL, NULL, NULL);
printf ("%#08x, %#08x\n", (unsigned int)stackFrame.AddrReturn.Offset, (unsigned int)stackFrame.AddrPC.Offset); } }
This still does not work for me. At least now I'm sure that the
context looks correct. But the stack trace still gets nowhere,
certainly not to the previous functions from whence I came.
Perhaps I am missing something. The StackWalk64 has various callback
functions. I have tried initializing the symbols and using the
built-in callbacks, but with both that or passing NULL I get the same
result. Does anybody know whether those functions are needed? If so,
how do I define those functions?
Anything else I might be missing here?
Thank you,
John
"clyclopedic" <no******@spamless.com> wrote in message news:<OK**************@TK2MSFTNGP10.phx.gbl>... Change your test program so that it raises an exception and gets the thread context from the exception information.
CONTEXT context; char *p = 0;
__try { *p = 0; // or create your own exception and Raise() it. } __except(CopyMemory(&context, (GetExceptionInformation())->ContextRecord, sizeof(context)), EXCEPTION_EXECUTE_HANDLER) { // run your traceback. But.. // DONT set any initial values in the STACKFRAME64. Let him figure it out from the context. It works for me. }
"John Riggs" <j_*******@hotmail.com> wrote in message
news:4f**************************@posting.google.c om... The StackWalk64 has various callback functions. I have tried initializing the symbols and using the built-in callbacks, but with both that or passing NULL I get the same result. Does anybody know whether those functions are needed? If so, how do I define those functions?
In my implementation I use my own function for ReadMemoryRoutine. For
in-process traces, the function I use simply calls IsBadReadPtr() and if
that's OK, CopyMemory(). I have a different function I use when running as a
debugger on another process. For the FunctionTableAccessRoutine and
GetModuleBaseRoutine parms I pass in SymFunctionTableAccess64 and
SymGetModuleBase64 from dbghelp. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: john.leonard.ireland |
last post by:
Hi all,
I don't know what I'm missing here, but if anyone could help me out I'd
really appreciate it. Basically, everything is fine, compiles,
installs, server runs, but the interactive mysql...
|
by: Manuel Duran Aguete |
last post by:
Hi all,
I'm interesting to know about experiences of usign postgresql in ia64
under linux.
* What about performance ?
* What about stability ?
* Which linux version ? At now, I usign debian...
|
by: Ed L. |
last post by:
Has anyone successfully built 7.3.4, 7.4.3, or 8.0.0beta1 on
IA64 with HP-UX 11i v2 (11.23)? I'm not having any success,
running into 'make' failures. Googling old posts suggests
this might be...
|
by: Ed L. |
last post by:
I've installed both 32-bit and 64-bit executables of 7.4.5 on ia64 running
HP-UX B.11.23. The 32-bit version works fine and accepts both local and
remote connections. The 64-bit version, however,...
|
by: Rajiv Das |
last post by:
Can I build a .Net assembly on a Win32 box and run it seamlessly on IA64 and
x64 machines?
I am currently using the "Any CPU" configuration in VS2005
Does the scenario change for an assembly...
|
by: Yuanfei |
last post by:
Hi there,
I am porting a project to IA64, AMD64(X64) with VS2005 Professional Edition
on a 32bit box. The version of VS2005(32bit) I used is 8.0.50727.42.
However, I just found that only x64...
|
by: Brian |
last post by:
Is there any way to update an access database on an Itanium
machine(IA64)? I noticed that there is no 64 bit Jet Driver available
from Microsoft :
'Microsoft.Jet.OLEDB.4.0' provider is not...
|
by: mvjohn100 |
last post by:
Dear Friends,
For intel's core2 duo processor which debian I want to install? is it ia64?
Thanks
|
by: mcarthybn |
last post by:
hi ,
I am working on huge C programming project.I am doin debugging only by printf
measn i dont have any dubugger .So it is very difficult know who is actually calling a function and i am stuck...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |