473,395 Members | 1,931 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.

Debug optimized code? (with inlined methods)

I want to experiment with the JIT compiler's optimization of code,
especially regarding inline compilation of small methods.

What I have done is set the Build options for 'Optimize Code' to TRUE
and set 'Generate debugging information' to TRUE.
I run the compiled application from Windows Explorer, crank up Visual
Studio .NET, and attach to the running application with Tools -> Debug
Processes...

Since I generated debugging information I can step through C# source
code and the disassembly. However, small methods I thought would have
been inlined by the compiler are not.

Have I erred in the process somehow and prevented inline compilation?
Is there a more appropriate way to accomplish my goal?
Nov 15 '05 #1
8 4586
Hi Fuzzy,

I am not 100% sure on this but I think that you won't get optimized code
when you generate debugging information...
Rather, build Relase and look into IL code.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Fuzzy" <tr******@earthlink.net> wrote in message
news:95**************************@posting.google.c om...
I want to experiment with the JIT compiler's optimization of code,
especially regarding inline compilation of small methods.

What I have done is set the Build options for 'Optimize Code' to TRUE
and set 'Generate debugging information' to TRUE.
I run the compiled application from Windows Explorer, crank up Visual
Studio .NET, and attach to the running application with Tools -> Debug
Processes...

Since I generated debugging information I can step through C# source
code and the disassembly. However, small methods I thought would have
been inlined by the compiler are not.

Have I erred in the process somehow and prevented inline compilation?
Is there a more appropriate way to accomplish my goal?

Nov 15 '05 #2
Inlining is performed by the JITter, but it's turned off when the VS
debugger is attached. Your only option is to use a native code debugger like
the kd. exe, windbg.exe or cdb.exe.

Willy.

"Fuzzy" <tr******@earthlink.net> wrote in message
news:95**************************@posting.google.c om...
I want to experiment with the JIT compiler's optimization of code,
especially regarding inline compilation of small methods.

What I have done is set the Build options for 'Optimize Code' to TRUE
and set 'Generate debugging information' to TRUE.
I run the compiled application from Windows Explorer, crank up Visual
Studio .NET, and attach to the running application with Tools -> Debug
Processes...

Since I generated debugging information I can step through C# source
code and the disassembly. However, small methods I thought would have
been inlined by the compiler are not.

Have I erred in the process somehow and prevented inline compilation?
Is there a more appropriate way to accomplish my goal?

Nov 15 '05 #3
Inlining is performed by the JITter, but it's turned off when the VS
debugger is attached. Your only option is to use a native code debugger like
the kd. exe, windbg.exe or cdb.exe.

Willy.

"Fuzzy" <tr******@earthlink.net> wrote in message
news:95**************************@posting.google.c om...
I want to experiment with the JIT compiler's optimization of code,
especially regarding inline compilation of small methods.

What I have done is set the Build options for 'Optimize Code' to TRUE
and set 'Generate debugging information' to TRUE.
I run the compiled application from Windows Explorer, crank up Visual
Studio .NET, and attach to the running application with Tools -> Debug
Processes...

Since I generated debugging information I can step through C# source
code and the disassembly. However, small methods I thought would have
been inlined by the compiler are not.

Have I erred in the process somehow and prevented inline compilation?
Is there a more appropriate way to accomplish my goal?

Nov 15 '05 #4
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:<O5*************@tk2msftngp13.phx.gbl>...
Inlining is performed by the JITter, but it's turned off when the VS
debugger is attached. Your only option is to use a native code debugger like
the kd. exe, windbg.exe or cdb.exe.


What if I start the optimized EXE (and exercise the particular code
I'm interesting in) in order for the JITer to compile the application,
THEN attach the Visual Studio debugger?

Will the debugger attach to the already compiled (and hopefully
optimized) image ?
Nov 15 '05 #5
I'm most interested in actual in-line compilation of short methods, so
I need to examine the assembly produced by the JIT compiler at
runtime. Since I'm seeing NO inline methods, I'm hoping attaching the
Visual Studio debugger to a running EXE is the culprit!

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:<#R**************@TK2MSFTNGP12.phx.gbl>...
Hi Fuzzy,

I am not 100% sure on this but I think that you won't get optimized code
when you generate debugging information...
Rather, build Relase and look into IL code.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Nov 15 '05 #6
The JIT does the inlining. You won't see inlined methods at the IL level.
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Fuzzy" <tr******@earthlink.net> wrote in message
news:95**************************@posting.google.c om...
I'm most interested in actual in-line compilation of short methods, so
I need to examine the assembly produced by the JIT compiler at
runtime. Since I'm seeing NO inline methods, I'm hoping attaching the
Visual Studio debugger to a running EXE is the culprit!

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message

news:<#R**************@TK2MSFTNGP12.phx.gbl>...
Hi Fuzzy,

I am not 100% sure on this but I think that you won't get optimized code
when you generate debugging information...
Rather, build Relase and look into IL code.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Nov 15 '05 #7

"Fuzzy" <tr******@earthlink.net> wrote in message
news:95**************************@posting.google.c om...
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:<O5*************@tk2msftngp13.phx.gbl>...
Inlining is performed by the JITter, but it's turned off when the VS
debugger is attached. Your only option is to use a native code debugger
like
the kd. exe, windbg.exe or cdb.exe.


What if I start the optimized EXE (and exercise the particular code
I'm interesting in) in order for the JITer to compile the application,
THEN attach the Visual Studio debugger?

Will the debugger attach to the already compiled (and hopefully
optimized) image ?


Sure, but make sure CLR debugging is off and Native in On.

Willy.


Nov 15 '05 #8
Hi again,

See this article - it gives you some insides:
Writing High-Performance Managed Applications : A Primer
http://tinyurl.com/3e9n3

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Fuzzy" <tr******@earthlink.net> wrote in message
news:95**************************@posting.google.c om...
I want to experiment with the JIT compiler's optimization of code,
especially regarding inline compilation of small methods.

What I have done is set the Build options for 'Optimize Code' to TRUE
and set 'Generate debugging information' to TRUE.
I run the compiled application from Windows Explorer, crank up Visual
Studio .NET, and attach to the running application with Tools -> Debug
Processes...

Since I generated debugging information I can step through C# source
code and the disassembly. However, small methods I thought would have
been inlined by the compiler are not.

Have I erred in the process somehow and prevented inline compilation?
Is there a more appropriate way to accomplish my goal?

Nov 15 '05 #9

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

Similar topics

4
by: Alexander Eisenhuth | last post by:
Hi alltogether, I use ActivePython 2.4.1 , also the debug part from http://ftp.activestate.com/ActivePython/etc/ and VC 6.0 unter Windows XP. I can't figure out howto debug my c++ extension....
3
by: Glen Low | last post by:
I have written a new implemention of the std::valarray library that is optimized to use Altivec (Apple's "Velocity Engine", part of the PowerPC G4's in most Macintoshes and the announced IBM PPC...
2
by: John Black | last post by:
Hi, I am using assert() to hide some debug dump out like this, int dump(){ ... some printf... return 0; } then in my main code, I do this, assert(dump() == 0);
11
by: Markus Dehmann | last post by:
I have a static const bool debug = false; variable in my class. Debug output goes like this, trivially: if(debug) cerr << "debug message"; Is it guaranteed that this if/then clause is always...
5
by: John Smith | last post by:
Sorry if this is the wrong forum... Does anyone know what the difference is between a debug build and an optimised debug build in Visual Studio 2003?
5
by: David Krmpotic | last post by:
it's me again.. with quite interesting discovery :) I was tracing an error for 3 hours instead of 3 minutes because of this surprise. Recently I'm compiling this project in RELEASE with Debug...
2
by: Michael Nemtsev | last post by:
AFAIK, method could be candidate for inlining. But is it possible to view after compiling that method became inlined? Are there some keywords in ILDASM that can show that method is inlined? ---...
3
by: Chris288 | last post by:
Hi, I have a problem where our app when compiled in VS2005 runs about 50% the speed it attains in VS2003. This is an unmanaged C++ app. I have tried most combinations of the optimization and...
11
by: ThunderMusic | last post by:
Hi, I have a windows service that only loads a CSV file and import it's data using SqlBulkCopy in a newly created Sql Server 2005 table using 25000 rows batches. If I build the service in debug...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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
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...
0
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,...

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.