473,788 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StackWalk64 on IA64

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 = GetCurrentThrea d();
HANDLE hProcess = GetCurrentProce ss();

CONTEXT context;
memset (&context, 0, sizeof(context) );
context.Context Flags = CONTEXT_CONTROL ;
success = GetThreadContex t(hThread, &context);

STACKFRAME64 stackFrame;
memset (&stackFrame, 0, sizeof(stackFra me));

stackFrame.Addr PC.Offset = context.StIIP;
stackFrame.Addr PC.Mode = AddrModeFlat;
stackFrame.Addr Stack.Offset = context.IntSp;
stackFrame.Addr Stack.Mode = AddrModeFlat;
stackFrame.Addr BStore.Offset = context.RsBSP;
stackFrame.Addr BStore.Mode = AddrModeFlat;
DWORD machineType = IMAGE_FILE_MACH INE_IA64;

while (success)
{
success = StackWalk64(mac hineType, hProcess, hThread,
&stackFrame, &context, NULL, NULL, NULL, NULL);

printf ("%#08x, %#08x\n", (unsigned int)stackFrame. AddrReturn.Offs et,
(unsigned int)stackFrame. AddrPC.Offset);
}
}
Nov 16 '05 #1
3 2648
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(CopyMe mory(&context, (GetExceptionIn formation())->ContextRecor d,
sizeof(context) ), EXCEPTION_EXECU TE_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_*******@hotm ail.com> wrote in message
news:4f******** *************** ***@posting.goo gle.com...
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 = GetCurrentThrea d();
HANDLE hProcess = GetCurrentProce ss();

CONTEXT context;
memset (&context, 0, sizeof(context) );
context.Context Flags = CONTEXT_CONTROL ;
success = GetThreadContex t(hThread, &context);

STACKFRAME64 stackFrame;
memset (&stackFrame, 0, sizeof(stackFra me));

stackFrame.Addr PC.Offset = context.StIIP;
stackFrame.Addr PC.Mode = AddrModeFlat;
stackFrame.Addr Stack.Offset = context.IntSp;
stackFrame.Addr Stack.Mode = AddrModeFlat;
stackFrame.Addr BStore.Offset = context.RsBSP;
stackFrame.Addr BStore.Mode = AddrModeFlat;
DWORD machineType = IMAGE_FILE_MACH INE_IA64;

while (success)
{
success = StackWalk64(mac hineType, hProcess, hThread,
&stackFrame, &context, NULL, NULL, NULL, NULL);

printf ("%#08x, %#08x\n", (unsigned int)stackFrame. AddrReturn.Offs et,
(unsigned int)stackFrame. AddrPC.Offset);
}
}

Nov 16 '05 #2
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

"clyclopedi c" <no******@spaml ess.com> wrote in message news:<OK******* *******@TK2MSFT NGP10.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(CopyMe mory(&context, (GetExceptionIn formation())->ContextRecor d,
sizeof(context) ), EXCEPTION_EXECU TE_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.
}

Nov 16 '05 #3

"John Riggs" <j_*******@hotm ail.com> wrote in message
news:4f******** *************** ***@posting.goo gle.com...
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 ReadMemoryRouti ne. 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 FunctionTableAc cessRoutine and
GetModuleBaseRo utine parms I pass in SymFunctionTabl eAccess64 and
SymGetModuleBas e64 from dbghelp.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1567
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 client breaks. I have an IA64 Red Hat Linux Enterprise Edition system and I tried to install the binaries recommended on MySQL. However, when I run the mysql client, I get simply:
0
1204
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 in x86. * Any suggestion or recomendation ? * Better than alpha or sparc ?
11
3621
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 due to missing test-and-set code for ia64? I saw a disputed/repudiated ViSolve patch, but nothing else. Is this still broken? Here's my attempt on 8.0.0beta1: $uname -a
2
2082
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, rejects any/all attempts to connect with the following message: FATAL: no pg_hba.conf entry for host "???", user "dba", database "template1" These are using identical pg_hba.conf files. Any clues?
0
1024
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 built with /unsafe switch? --------------------- Thanks Rajiv Das
3
2051
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 cross-compiler is offered with VS2005 and there is no AMD64 cross-compiler! I wonder if IA64 cross-compiler is available now and how can I get it ? If I need to install special service pack or SDK ?
1
1471
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 registered on the local machine I am thinking there might be a way to install a 32 bit version of the drivers utilizing WOW and create an x86 assembly that does this. Before I dive in can anyone see an issue with this or has anyone got a workaround?
3
4094
by: mvjohn100 | last post by:
Dear Friends, For intel's core2 duo processor which debian I want to install? is it ia64? Thanks
12
31890
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 in a problem that , i have seen that one fucntion is get called by from some 160 postions. and i need to solve some problem and it is very probmatic to get print from 160 postions.So ,is there any way to get to know who is calling that function in...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.