473,761 Members | 4,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Debugging mixed DLL called from legacy code

I'm writing a mixed-mode C++ DLL which is used by an old C++
application that I don't have the source code to. I'm amazed by the
ease of interoperabilit y, but the one problem I'm having is debugging
the DLL, as the C++ app crashes if loaded into the debugger.

If I could just get the line number on which an exception occurred
that would be enough to fix most bugs. At the moment I use
exception.ToStr ing() and get a stack trace but it's very hard to find
the bug in a large function without knowing which line.

Anyone have any tips, either on how to get the legacy app to run under
the debugger (so I can step through my DLL when called), or get the
line number an exception occurred on?

Many thanks indeed,

Max Christian
Nov 17 '05 #1
3 2121
"Max Christian" <ne**@maxuk.net > wrote in message
news:c6******** *************** ***@posting.goo gle.com...
I'm writing a mixed-mode C++ DLL which is used by an old C++
application that I don't have the source code to. I'm amazed by the
ease of interoperabilit y, but the one problem I'm having is debugging
the DLL, as the C++ app crashes if loaded into the debugger.
...
Anyone have any tips, either on how to get the legacy app to run under
the debugger (so I can step through my DLL when called), or get the
line number an exception occurred on?


Well, if you can't run under the debugger can you put a DebugBreak() line at
some point when your DLL gets invoked and step through from there?

Still, I'm not sure I understand what crashes when. The crash occurs only
when you debug?

Did you

1) build the DLL with VS.Net?
2) specify the "legacy" executable in the "command"
edit box on the Debugging properties page
3) launch the executable by starting the debugger

Is that the sequence that crashes? Does it crash immediately?

Regards,
Will

Nov 17 '05 #2
"William DePalo [MVP VC++]" <wi***********@ mvps.org> wrote in message news:<#q******* *******@TK2MSFT NGP10.phx.gbl>. ..

Well, if you can't run under the debugger can you put a DebugBreak() line at
some point when your DLL gets invoked and step through from there?
Unfortunately that causes the C++ app to crash immediately, which
surprised me as it's obviously my code that's running when
DebugBreak() is called.

Still, I'm not sure I understand what crashes when. The crash occurs only
when you debug?
Yes, only when debugging. I do exactly the three things you've listed
below (using VS.NET 2003), I get a warning about no debug info in EXE,
I click OK to debug anyway, and then I get this msg box:

"The application failed to initalize properly (0xc0000142). Click on
OK to terminate the application."

As I say, the app works fine when not under the debugger.

M

Did you

1) build the DLL with VS.Net?
2) specify the "legacy" executable in the "command"
edit box on the Debugging properties page
3) launch the executable by starting the debugger


(Yes, I did all of those.)
Nov 17 '05 #3
"William DePalo [MVP VC++]" <wi***********@ mvps.org> wrote in message news:<#q******* *******@TK2MSFT NGP10.phx.gbl>. ..

Did you

1) build the DLL with VS.Net?
2) specify the "legacy" executable in the "command"
edit box on the Debugging properties page
3) launch the executable by starting the debugger


I've found an answer to this -- I changed the Debugger Type from Auto
to Managed Only in Configuration Properties|Debu gging and now it
works. (It crashes as before under both the Mixed and Native Only
modes.)

I hope that's useful to a future googler...

M
Nov 17 '05 #4

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

Similar topics

9
2592
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and explain it. I have some questions about the instructions for creating a mixed mode DLL in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the "Managed Extensions for C++ Reference"....
5
1268
by: John E Katich | last post by:
I'm just getting into VC++ managed code (VS 2003). Using the App Wizard I build a VC++ .NET Console Application. When I press F5 it takes 30 seconds to get to the Console::Writeline(). MFC or WIN32 Console App is Sub-Second response time.
0
3227
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs converted/developed with VB.NET. What I want from debugging is to be able to step into the methods in the DLLs called from ASP scripts using Visual Studio .NET. Background: For typical script debugging issues, you can read and follow the two documents on...
4
2243
by: Lonewolf | last post by:
hi, I'm still in the process of transiting from MFC/VC6 to vs2005, and a lot of things are very alien to me. So hope you could bear with me if my question sounds stupid. Basically I have native codes written in VC6 which I want to encapsulate in a managed assembly using C++/CLI so that I can use it in C# easily without all the interop codes. So, my question is, what is the replacement for MFC's TRACE macro in VS2005's C++/CLI in...
8
2321
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR types. The problem: I have a number of mixed-mode functions which I want reuse. These functions revolve around converting a CLR String to a C++ std::string or
4
1837
by: Edson Tadeu | last post by:
I have imported a project from Visual Studio .Net 2003, consisting only of native (unmanaged) C++ code. Debugging was very fast in that IDE, and I didn't even notice a delay when stepping over lines. Now, in MSVC 2005, each 'stepping over' takes between 1 and 2 seconds :( Why is that? Is there anyway to improve the MSVC 2005 debugger speed? I've already configured the project debugger type to Native Only, and I tried to change a lot of...
5
7802
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an app.config file referencing arbitrary versions of the plug-in components they wish to consume. Here's the problem: Assuming I have installed any one of our application software,
0
1108
by: Brian | last post by:
Hi. I need to place wrappers around a set of legacy VC++ 6 dlls and call them via Asp.Net. This works but I can't step into them. Every time I do, they step over, which is a bit of a nightmare. Everywhere I look it says to switch on 'mixed mode debugging', but there is *NO* such setting in this sort of web site! Neither the solution or the project has this setting. The debugging is enabled in
3
2426
by: Pixel.to.life | last post by:
All, A question on JIT debugging with VS2005. I have a managed app that builds great on one machine (Vista Home basic, VS2005, JIT enabled for managed/unmanaged code). I can also debug it on this machine with breakpoints and all.
0
9522
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9948
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
9902
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
9765
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
8770
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...
0
5215
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3866
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
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2738
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.