473,385 Members | 1,465 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,385 software developers and data experts.

cannot debug into native c++ dll.

Hi,

I have a pretty complicated program which consists of the following basic
modules:

1. a C# application
2. a C++/CLI application which is controlled by the C# app via IPC remoting
3. lots of native code which is wrapped by the managed C++/CLI code

A remark to this complicated structure: We are controlling hardware via
C/C++ driver interfaces. The C# app is the main user interface. We have seen
that the CLR's threading + memory management is not suitable for time
critical hardware interfaces. So we separated the hardware stuff from the
main process.

I start the C# UI in debug mode from within Visual Studio 2008. The UI
process then starts the C++/CLI and native code process and establishes the
interop connection. I usually just attach the debugger to the C++/CLI process
and can debug into the native code without any problem.

Now recently I had to create an extra VS solution only containing C++ dlls.
(I am using these dlls for 2 different projects). It consists of native code
windows dlls, exporting the classes and functions via dllexport. I have built
the dlls in debug mode and I have copied both dll and pdb into the ececution
directory of my original main app.

But: I cannot debug into these dlls although the debug information should be
there. The debugger just steps over a routine call instead of stepping into...

Do you have any ideas?

Thanks in advance for your help,

Fabian
Jul 3 '08 #1
6 6546
Hi Fabian,
I have a pretty complicated program which consists of the following
basic modules:

1. a C# application
2. a C++/CLI application which is controlled by the C# app via IPC
remoting
3. lots of native code which is wrapped by the managed C++/CLI code
...
But: I cannot debug into these dlls although the debug information
should be there. The debugger just steps over a routine call instead
of stepping into...

Do you have any ideas?
Make sure that under debugging options you select as debugger type
"mixed". By default this might be "auto" or "managed only" which
excludes native code.

--
SvenC
Jul 3 '08 #2
Hi Sven,
...
3. lots of native code which is wrapped by the managed C++/CLI code
...
But: I cannot debug into these dlls although the debug information
should be there. The debugger just steps over a routine call instead
of stepping into...

Make sure that under debugging options you select as debugger type
"mixed". By default this might be "auto" or "managed only" which
excludes native code.
In Visual Studio 2008's debugging options I just found a similar option
under "Just-In-Time". Both "Managed" and "Native" were already selected.
The weird thing is that I can debug into the native C++ dll projects in the
main project's solution. They are also not compiled with /CLR. So the only
difference I see is that the new dlls do not belong to the main Solution
file.

regards,

Fabian

Jul 3 '08 #3
Hi Fabian,
>>But: I cannot debug into these dlls although the debug information
should be there. The debugger just steps over a routine call instead
of stepping into...

Make sure that under debugging options you select as debugger type
"mixed". By default this might be "auto" or "managed only" which
excludes native code.

In Visual Studio 2008's debugging options I just found a similar
option under "Just-In-Time". Both "Managed" and "Native" were already
selected. The weird thing is that I can debug into the native C++ dll
projects in the main project's solution. They are also not compiled
with /CLR. So the only difference I see is that the new dlls do not
belong to the main Solution file.
Are those dlls compiled as debug versions? I think it is not sufficient to
just create pdb files for the release version of those dlls to debug them.
They must be debug builds.
Also make sure that if you have both debug and release dlls of your
projects available that your debugging session uses the debug dlls.

What type of solution do you use for debugging? A C++/win32 app,
a C# console or win forms or something else? Or do you attacht the
debugger to a running process?

--
SvenC
Jul 3 '08 #4
Hi Sven,
Are those dlls compiled as debug versions? I think it is not sufficient to
just create pdb files for the release version of those dlls to debug them.
They must be debug builds.
Everything is built as "debug".
Also make sure that if you have both debug and release dlls of your
projects available that your debugging session uses the debug dlls.
I have no release dlls in this case.
What type of solution do you use for debugging? A C++/win32 app,
a C# console or win forms or something else? Or do you attacht the
debugger to a running process?
The startup project is a C# Windows.Forms app. The second process containing
containing / accessing native C++ dlls is a C++/CLI Windows.Forms app.
To debug both processes I start the C# Windows app which then starts the
C++/CLI exe. When everything has started up I attach the debugger to the to
the C++/CLI process so it is attached to both the C# and the C++/CLI app.

I saw sth. else: When I have a look at the Modules window
(Debug->Windows->Modules) I don't see any of the external dlls. But they are
used.

Thx,

Fabian
Jul 3 '08 #5
Hi Fabian,
The startup project is a C# Windows.Forms app. The second process
containing containing / accessing native C++ dlls is a C++/CLI
Windows.Forms app.
To debug both processes I start the C# Windows app which then starts
the C++/CLI exe. When everything has started up I attach the debugger
to the to the C++/CLI process so it is attached to both the C# and
the C++/CLI app.
When you attached, did you recognize the field "Attach to:" right above the
list of processes with a "Select..." button on the right?
Click select and change from "Automatic" to "these code types" and
activate managed and native.

--
SvenC
Jul 3 '08 #6
Hi Sven,
When you attached, did you recognize the field "Attach to:" right above the
list of processes with a "Select..." button on the right?
Click select and change from "Automatic" to "these code types" and
activate managed and native.
That did the job. Thanks a lot!

regards

Fabian
Jul 3 '08 #7

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

Similar topics

0
by: Mike Grass | last post by:
Hello all, I know this may be a very ambiguous question, but I'm hoping that it is a common enough error that someone has encountered it before. I have a managed C++ program which interacts...
1
by: Maor Mishkin | last post by:
Hello All, I have an application that is written in c#, this application calls a native (not managed) c++ dll, the connection is good and the functions run great, I have a problem entering the c++...
4
by: Chua Wen Ching | last post by:
Hi there, I am looking forward to learn how to debug exe or dll files without the source codes. 1. As i understand that back in native, people use softice or ollydbg as a way to debug the...
10
by: Serg | last post by:
Every time i am trying to step into virtual funtion debugger tells me "there is no source code available" and disassemble window appears. If function is non virtual debugger succefully steps into...
3
by: tlemcenvisit | last post by:
Hi, I put a breakpoint on a line of code, it became (during the execution) empty with an exclamation point. I obtained the message "No executable code is associated with this line" when I point...
2
by: kevinding | last post by:
Hi All, We meet an evil condition for our project. Our project has 3 layers. A C# layer to do some business logic, and Managed C++ layer translate managed values to native ones or vice...
6
by: Bob Rock | last post by:
Hello, I'm using an executable (for which I do not have the source code nor the pdb file) as the startup application to load a DLL I'm writing and need to debug. If I try to debug the DLL I...
9
by: Bern McCarty | last post by:
I am porting stuff from MEC++ syntax to the new C++/CLI syntax. Something that we did in the old syntax that proved to be very valuable was to make sure that the finalizer would purposefully...
0
by: Husey | last post by:
Hi, I am trying to create a very simple EJB project which requires me to create a new jboss configuration in Eclipse. I keep getting the error message "An error has occurred. See error log for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
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$) { } ...
0
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...
0
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.