Thursday, March 31, 2005
Wednesday, March 30, 2005
ReHash - A console-based hash calculator
Tuesday, March 29, 2005
Monday, March 28, 2005
Opening a command prompt for your project
Opening a command prompt for your project
Sometimes while working with a VS.Net project, you need to run a command line tool, either on the sources or output of the project. VS provides an easy way to add a menu item that will open a command prompt in the target directory of your application, or in the source folder.
In order to enable this, first go to the Tools menu, and choose External Tools. In the add dialog box, create a new item, and give it a name such as Source Shell. The command should be cmd.exe. For initial directory, you can pick one of:
- $(ProjectDir) - source code for the current project
- $(SolutionDir) - root directory of the current solution
- $(TargetDir) - build location of the current project. This will adjust for different configurations, so it will open a shell in bin\Debug for debug builds, and bin\Release for release builds.
In my copy of VS I have a menu option for Source Shell, opening in $(ProjectDir), and one for Build Shell, opening in $(TargetDir). I also have a quick script that I run that sets up various environment variables, network drive maps, and drive substitutions, in order for me to have a useful dev command window. I get this script to run by adding
/k SetDevEnv.cmd
To the arugments line.
Wednesday, March 23, 2005
Visual C# Developer Center: Tools
Tuesday, March 22, 2005
Indian Grocery Store in Spokane
Why does the debugger show me the wrong function? - identical COMDAT folding
Why does the debugger show me the wrong function?
Often you'll be minding your own business debugging some code, and you decide to step into one function and the debugger shows that you're in some other function. How did that happen?
class Class1
{
public:
int *GetQ() { return q; }
private:
int *p;
int *q;
};
class Class2
{
public:
virtual int GetValue() { return value; }
private:
int value;
};
You then step through code that does something like this:
int Whatever(Class2 *p)
{
return p->GetValue();
}
And when you step into the call to p->GetValue()
you find yourself in Class1::GetQ
. What happened?
What happened is that the Microsoft linker combined functions that are identical at the code generation level.
?GetQ@Class1@@QAEPAHXZ PROC NEAR ; Class1::GetQ, COMDAT
00000 8b 41 04 mov eax, DWORD PTR [ecx+4]
00003 c3 ret 0
?GetQ@Class1@@QAEPAHXZ ENDP ; Class1::GetQ
?GetValue@Class2@@UAEHXZ PROC NEAR ; Class2::GetValue, COMDAT
00000 8b 41 04 mov eax, DWORD PTR [ecx+4]
00003 c3 ret 0
?GetValue@Class2@@UAEHXZ ENDP ; Class2::GetValue
Observe that at the object code level, the two functions are identical. (Note that whether two functions are identical at the object code level is highly dependent on which version of what compiler you're using, and with which optimization flags. Identical code generation for different functions occurs with very high frequency when you use templates.) Therefore, the linker says, "Well, what's the point of having two identical functions? I'll just keep one copy and use it to stand for both Class1::GetQ
and Class2::GetValue
."
0:000> u Class1::GetQ
010010d6 8b4104 mov eax,[ecx+0x4]
010010d9 c3 ret
0:000> u Class2::GetValue
010010d6 8b4104 mov eax,[ecx+0x4]
010010d9 c3 ret
Notice that the two functions were merged: The addresses are identical. That one fragment of code merely goes by two names. Therefore, when the debugger sees that you've jumped to 0x010010d6
, it doesn't know which of the names it should use, so it just picks on.
That's why it looks like you jumped to the wrong function.
To disable what is called "identical COMDAT folding", you can pass the /OPT:NOICF
flag to the linker.
Sunday, March 20, 2005
Gurudwara (Sikh temple) in Spokane, Wa
Indian restaurant in Spokane, Washington
Thursday, March 17, 2005
DirectX and .Net - Tutorials
Monday, March 14, 2005
Generating a Random Password - C#
Thursday, March 10, 2005
String to Enumeration Value C#
Monday, March 07, 2005
Using MemoryStream .NET
Friday, March 04, 2005
Free e-books for programmers
Wednesday, March 02, 2005
.NET Debugger Visualizations - Hashtable
Tuesday, March 01, 2005
Dr. GUI .NET #4 - System.Object and Garbage Collection
MapPoint
For starting information on MapPoint have a look at these links:
http://msdn.microsoft.com/mappoint/
http://www.microsoft.com/mappoint/default.mspx
http://www.microsoft.com/mappoint/products/webservice/default.mspx
http://blogs.msdn.com/cthota/category/7155.aspx
http://www.microsoft.com/mappoint/products/webservice/regional.mspx
New TLAs
CCE | Compute Cluster Edition |
HPC | High Performance Computing |
ISV | Independent Software Vendor |
RTM | Release To Manufacturing |
SKU | Stock Keeping Unit |
x64 | AMD 64-bit and Intel EM64T |