472,791 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 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 6489
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.