473,545 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1994

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

Similar topics

6
4706
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 article which covers this: http://support.microsoft.com/default.aspx?scid=kb;en-us;299633#2
6
2497
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
2046
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
3029
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 this(only demo code) class a{ public: virtual void fun() { cout<<"Base class";
9
13027
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 created and what they would contain: class base { virtual void display() { cout<<"base display"<<endl;
17
14692
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 vfptr i.e the pointer to vtable internally. What confuses me is if vtable is an array of pointer to virtual functions then as per the properties...
9
2297
by: schand | last post by:
How does the virtual table accessed in MMU based system?
0
659
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
3622
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 (if not all) C++ compilers for the MSW use a very similar vtable layout. In COM, this is handled by proxies provided by system dlls,
0
7499
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
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...
0
7689
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. ...
1
7456
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...
0
6022
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...
0
5076
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...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.