Archive for April, 2009

Reading Notebook: 23-Apr-09

Friday, April 24th, 2009

Comments in italics are mine and express my own views, thoughts and opinions

Developer’s Guide to Debugging by M. Wloka, et al.:

debugging as reverse engineering (p. 169)

two camps of source commenters (pp. 169 - 170) - I personally tend to belong to the camp of writers of self-documentary code 

workaround turns a bug once the underlying cause is fixed (p. 171)

consistent coding style (p. 171) - I fully agree and when I fix a bug I adopt whatever coding style is used in the code 

naming style (pp. 171 -172) - Here I would say that MS prefers its own styles (Hungarian notation) instead of C++ standard library and I prefer to use the former when writing programs on Windows except maybe short illustrative examples for language features and exception processing. And I don’t like underscores as name separators.

spreading the code (p. 172) - I even tend to split complex logical expressions into several lines of code

avoiding macros (pp. 173 - 178) - regarding macros in C/C++: an idea came to me for the need to have a program or WinDbg extension that gives you macro text for any given number. For example, a window message text, an status or error value text, and so on. This would be handy for raw debugging or postmortem crash dump analysis

debugging preprocessor output via a compiler switch (pp. 176 - 177)

external preprocessors like m4 (pp. 177 - 178) - I’m considering to use an external preprocessor for the Riemann programming language I invented.

custom debugging functions in code to call from a debugger (pp. 179 - 181)

writing analysis functions (p. 180) - I used this when writing a word processor long time ago to check the consistency of internal structures: http://www.dumpanalysis.org/blog/index.php/2006/12/16/real-programmers-no-impossible-code/

coupling tracing with postmortem dumps (pp. 181 - 182) - See also Historical Information and Execution Residue patterns: http://www.dumpanalysis.org/blog/index.php/2007/11/06/crash-dump-analysis-patterns-part-34/ and http://www.dumpanalysis.org/blog/index.php/2008/04/29/crash-dump-analysis-patterns-part-60/. Also in Citrix environments we use CDF logging which can be circular coupled with memory dump analysis

static checking as an aid in debugging (pp. 183 - 190) - I recall that when I was working at Programming Research Ltd. on their static QA C++ checker and particular STL usage checks we used it against our own C++ code and I confess that there was no need to use GDB. In a few times when program crashed I used logging to narrow down the statement

cleanup session to eliminate all compiler warning (p. 184) - I hate compiler warnings too and change code until they disappear

Finished this book!!! Edited notes also appear in Software Engineering Notebooks, Volume 1 (ISBN: 978-1906717148) later this year

Advanced Windows Debugging by M. Hewardt and D. Pravat:

Concurrent Programming on Windows by J. Duffy:

Software Factories by J. Greenfield, et. al.:

Software Engineering Foundations: A Software Science Perspective, by Y. Wang:

Didn’t have time today - resume reading next week

- Dmitry Vostokov @ SoftwareGeneralist.com -

Reading Notebook: 22-Apr-09

Wednesday, April 22nd, 2009

Comments in italics are mine and express my own views, thoughts and opinions

Developer’s Guide to Debugging by M. Wloka, et al.:

function arguments from stack (pp. 163 - 165) - kv, kP or kp WinDbg; also .frame and dv commands 

p sizeof (int) in GDB (p. 163) - equivalent to ?? sizeof (int) in WinDbg

x/s in GDB (p. 164) - da command in WinDbg; du for UNICODE

info reg in GDB (p. 164) - r command in WinDbg

safe register association with arguments at the beginning of a function (p. 164) - See my Optimized Code pattern: http://www.dumpanalysis.org/blog/index.php/2006/12/15/crash-dump-analysis-patterns-part-5/

The notion of an argument anchor to search for other arguments on a raw stack (p. 164) - very useful technique I used many times

user-defined data types (p. 165) - in the absence of symbols for dt command it is indeed tedious to find field correspondence between headers and binaries  

approximate source code line (pp. 165 - 166) - ln command and, of course, disassembling u, ub and uf WinDbg commands. Beware of OMAP optimization though: http://www.dumpanalysis.org/blog/index.php/2007/04/20/crash-dump-analysis-patterns-part-5b/

stepping through assembly code set step 1, nexti in GDB (pp. 166 - 167) - l-t to switch to assembly mode from source mode and then t or ta (trace to address) WinDbg commands

Advanced Windows Debugging by M. Hewardt and D. Pravat:

Concurrent Programming on Windows by J. Duffy:

Software Factories by J. Greenfield, et. al.:

Software Engineering Foundations: A Software Science Perspective, by Y. Wang:

Didn’t have time today - resume reading tomorrow

- Dmitry Vostokov @ SoftwareGeneralist.com -

Reading Notebook: 21-Apr-09

Tuesday, April 21st, 2009

Comments in italics are mine and express my own views, thoughts and opinions

Developer’s Guide to Debugging by M. Wloka, et al.:

manipulating program code and data in a debugger instead of recompilation (pp. 153 - 161)

print GDB command (p. 154) - dv WinDbg command and also various variants of d command 

set var GDB command (p. 154 ) - e command variations in WinDbg; also r command to change registers or $retreg

call GDB command (p. 154) - .call command in WinDbg

getting out of functions ot skipping code (p. 154) - in WinDbg you can assemble nop, jump or ret opcodes for this purpose; also consider changing $ip

whatis GDB command (p. 159) - x, dt and dv WinDbg commands

x GDB command (p. 159) - d command variants in WinDbg

debugging without symbols (p. 161) - On Windows and with Visual C++ it is easy to handle as symbol files (.PDB) can be kept separately and even accessible from customer environments via public symbol servers

Advanced Windows Debugging by M. Hewardt and D. Pravat:

Concurrent Programming on Windows by J. Duffy:

Software Factories by J. Greenfield, et. al.:

Software Engineering Foundations: A Software Science Perspective, by Y. Wang:

Didn’t have time today - resume reading tomorrow

- Dmitry Vostokov @ SoftwareGeneralist.com -

Reading Notebook: 20-Apr-09

Monday, April 20th, 2009

Comments in italics are mine and express my own views, thoughts and opinions

Developer’s Guide to Debugging by M. Wloka, et al.:

watchpoints (data breakpoints), watch and *watch GDB commands (pp. 143 -144) - ba in WinDbg

signals (pp. 144 - 146) - APC on Windows?  Asynchronous exceptions on Windows?

exceptions in C++, catch and throw GDB commands (pp. 147 - 148) - A hint for Visual C++. You need to specify exception model via /EH switch   

reading stack traces, where GDB command (pp. 148 - 153) - k command variants in WinDbg

frames reported as ?? in GDB (pp. 149 - 150) - In WinDbg we have similar cases when PDB files are not available, module code is not present or simply basic frame based linking doesn’t work and WinDbg is not able to reconstruct stack trace. Here we have a message: “WARNING: Frame IP not in any known module. Following frames may be wrong.”

Broken stack traces (pp. 151 - 152) - Here is my case study about manual stack trace reconstruction using WinDbg: http://www.dumpanalysis.org/blog/index.php/2007/07/25/reconstructing-stack-trace-manually/

core dump files (pp. 152 - 153) - For Windows there are plenty of possibilities to get crash dump files. Look for articles in “The Origin of Crash Dumps” chapters in Memory Dump Analysis Anthology, Volume 1 and Memory Dump Analysis Anthology, Volume 2. WinDbg is the standard tool to analyze crash dumps in technical support. 

Advanced Windows Debugging by M. Hewardt and D. Pravat:

Concurrent Programming on Windows by J. Duffy:

Software Factories by J. Greenfield, et. al.:

Software Engineering Foundations: A Software Science Perspective, by Y. Wang:

Didn’t have time today - resume reading tomorrow

- Dmitry Vostokov @ SoftwareGeneralist.com -

Reading Notebook: 15-Apr-09

Wednesday, April 15th, 2009

Resuming reading notebook and plan to fill it at least 3-4 times per week

Comments in italics are mine and express my own views, thoughts and opinions

Developer’s Guide to Debugging by M. Wloka, et al.:

Implicit or hidden function calls in high level languages, step-into command, GDB step (pp. 133 - 135) - t command in WinDbg

step-out command to bypass stepping through implicit functions, GDB finish command (p. 136) - gu command in WinDbg

temporary breakpoint in GDB, tbreak (p. 136) - also .step_filter in WinDbg to create the list of function to skip

conditional breakpoints and breakpoint commands (pp. 138 -139) - bp and ba commands in WinDbg have an additional parameter: command string; Also bp “J” and bp “.if” conditional variants in WinDbg

print strcmp(…) and $$0 in GDB (p. 139) - I think in WinDbg this can be done via .call and $callret

static constructors and initializers (pp. 140 - 143)

technique: slowing the program to have time to attach the debugger (p. 142)

Advanced Windows Debugging by M. Hewardt and D. Pravat:

.dbgdbg command (p. 368)

technique: using local kernel debugger when user debugger extension fails (p, 375)

Concurrent Programming on Windows by J. Duffy:

A thread may already begin or even finish by the time CreateThread returns (p. 89)

thread pseudo-handle from GetCurrentThread == -2 (p. 94)

thread handle from thread id - OpenThread (p. 95)

use CRT function only in threads created by _beginthread(ex) (p. 96)

_beginthread closes handle automatically by return of start routine (p. 97)

Software Factories by J. Greenfield, et. al.:

EAI to solve the problem of data flow and transformation between applications on different servers (p. 21)

Building applications from business process perspective (p. 22)

DCOM and CORBA are tightly coupled to component implementations (p. 23)

service-oriented architecture (SOA): loosely coupled coarse grained components, message interaction, protocol sequencing defined by contracts and negotiated constraints (SLA, service level agreements) (p. 25)

BPMS (business process management system) as logical analog to DBMS (pp. 25 - 26)

pi-calculus as theoretical platform for BPMS (p. 25)

CRM subprocesses: campaigns, sales force and leads, customer management, customer service and self-service (pp. 28 - 29)

Portals as encapsulation of user interaction (p. 30) - an idea of tool portals for troubleshooting; Also each troubleshooting domain is implemented as a troubleshooting process or service that encapsulates troubleshooting logic and required data access; troubleshooting facades working with older troubleshooting tools

Software Engineering Foundations: A Software Science Perspective, by Y. Wang:

Didn’t have time today - resume reading tomorrow

- Dmitry Vostokov @ SoftwareGeneralist.com -