Bugs that hide from debuggers

Sometimes running a program under a debugger makes it work.   Running the same program without a debugger causes a failure or a crash.   Here are some reasons why this can happen: 1.   Timing – attaching a debugging changes timing and can hide race conditions.   Even without single-stepping and without using breakpoints, the debugger is affecting…

0

x64 calling convention and the disappearing process syndrome

Raymond Chen describes the parameter passing aspect of the x64 calling convetions.   But there is more than parameter passing to the calling convention.   Exception handling is an important part of the calling convention. A function that calls another function or needs to allocate stack space or requires exception handling (e.g. has a try statement) must…

1

Why doesn’t sampling show the actual time spent in each function?

Some people have asked for a “wall clock time” column in the sampling profiler report.   Unfortunately, the actual time spent in a function cannot be reliably deduced from the collected data.  Sampling counts “hits” on a function when a certain event occurs.  By default, this event is a CPU cycle counter counting N cycles, but…

1

There are no Safe Functions – only Safe Programming

The Platform SDK includes a set of string manipulation functions defined in strsafe.h.   These functions were added during the Windows Security push.  The functions offer an alternative to the C run-time string functions which is more consistent, and less error-prone than the C standard functions. But in order for the functions to actually be safe,…

5

ISA Server 2004

ISA Server 2004 is now available.    Lots of new and improved features.  

0

Why does the compiler generate a MOV EDI, EDI instruction at the beginning of functions?

Why does the compiler generate a MOV  EDI, EDI instruction at the beginning of functions?   I’ve recently noticed that on the XPSP2 Beta that I am running the function prologs look like this:            MOV    EDI, EDI      PUSH   EBP      MOV    EBP, ESP   The PUSH  EBP and MOV EBP, ESP instructions…

3

Battered fries are considered “fresh vegetables”!?

Well, probably not by nutritionists, but the USDA, backed by a court decision says they are. (Above link will probably expire in few days). [typo corrected 15:00]

2

Developing firewall and NAT friendly network applications

Developing firewall and NAT friendly network applications When I worked on ISA Server I’ve seen network applications that were incompatible with firewalls and NAT and were difficult or impossible to configure the firewall for, even when the firewall administrator wanted the application to pass through.   Below are some design considerations that can help make network…

2

It is not always the CPU

Before you start to actually profile your application, you do not know what the bottleneck is.    It is not uncommon to see people trying to “optimize” code and save CPU cycles in places were it is not really required.   This leads to obfuscated code that is less easy to maintain without a real performance benefit….

0