473,395 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to add a debug hook - via trampoline or direct VTABLE access?

Hi *,

I'm debugging a crash in a very big and complex server application.

This server run's fine for days and hours and suddenly crashes. I've
spent 2 weeks of time now, but cannot find the problem.

I believe that there is a method call with an already deleted objects
causing the crash, something like

SomeClass *obj = new SomeClass();
...
delete obj;
...
obj->somefunction() // infrequently crashed here

The idea I now have is to "catch" access to every method call in a
"debug hook" function.

In this "debug hook" I check the object, and dispatch to the original
method call if the object is valid. If it is not valid, than I have a
breakpoint hit and can do a stacktrace.

Currently I'm using MS Visualt Studio 6, but it is multiple platform
project and it compiles with g++ under Linux too. Thus a solution does
not have to be portable - it is only for debugging purposes.

I have looked around the web and found something called a 'trampoline'
technique used by g++ compilers. That sounds like I need for this
debugging purpose. But I couldn't find/did not understand how to use it.

Another idea I had was to manipulate the VTABLE entry of the base class
and modify it to jump to the "debug hook" function. This should work
because nearly every methods in our classes are virtual methods.

Does anyone have a tip for me? Or other ideas?

thanks a lot for your help, -Hans
Jul 22 '05 #1
0 1988

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

Similar topics

6
by: Grant Schenck | last post by:
Hello, I'm trying to figure out how to debug a very simple COM object I developed in VB. I'm very new to VB and ASP so I have a lot to learn. That said, I found what I thought was perfect...
6
by: Nolan Martin | last post by:
Hello, I was wondering if it were possible to access the vtable directly. Are there any resources that detail the inner workings of the vtable?
4
by: Clint Ruen | last post by:
Hello all, I have written out a data structure using the binary flag on an ofstream. The struct/class is something like this class SomeData { public: int data1;
4
by: rahul8143 | last post by:
hello, what happens to VTABLE when base class has virtual function and derived class does not override it? Does derived class also builds VTABLE if it has no functions? eg. if code is like...
9
by: kish_nand | last post by:
Could someone please explain me the concept behind virtual functions and vtables. I am little confused about this. Please refer to the following code and tell me how many virtual tables would be...
17
by: ypjofficial | last post by:
Hello All, I have read in many c++ literature that vtable is nothing but an array of pointer to virtual functions inside a class.And the class where the virtual function/s are declared stores the...
9
by: schand | last post by:
How does the virtual table accessed in MMU based system?
0
by: jase | last post by:
can anyone direct me how to set a system wide hook to access the print structure sent to the os when a print command is fired from any application???
10
by: Ole Nielsby | last post by:
James Kanze <james.kanze@gmail.comwrote: COM does rely on vtable layout. COM interfaces are declared as pure virtual classes, all methods using stdcall convention, and this works because most...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
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,...
0
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...
0
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...

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.