jacob navia wrote, On 12/03/08 19:28:
Of course, you had the whole program, algorithm, and field experience
with you in your head already loaded.
I had never even looked at the code in question before. I probably new
as much about it as you know about the source code for Microsoft Visual C++.
How about debugging my assembler output compiled in the
"just in time" compiler I wrote for a customer?
How much will you pay me? I'm not cheap.
There, you would find that you have no clue, because you do
not know at all what the program is doing.
Not uncommon when you have never seen the code before.
Neither do I, so, even if I wrote the compiler, debugging
that without a debugger is just hopeless!
Depends.
That can only work in incremental situations or very specific
situation when it is YOU that wrote all the code and you had
a great deal of experience with the program from countlessw
debugging sessions.
To be more precise I wrote exactly NONE of that code and had never seen
it or the algorithms it implemented before. Shortly before doing this I
was sent on a course to learn the assembler language it was written in.
This project was my first real use of the language, and the people who
had done all of the previous work on the code had already left the company.
That is useful. lcc-win fills the memory of the local variables at start
of a function with a special value that will provoke a trap in most
cases. This makes programs that "run with MSVC" trap sometimes, and I
get blamed.
The systems I am thinking of are even more useful. They do not rely at
all on what the contents of the memory is and will work just as well if
you are reading an unsigned char which does not even have a trap
representation.
lcc-win's debuggers uses the HW breakpoints of the processor.
But they can't do that.
Well, I will admit that I spent 25000UKP (excluding VAT) of the
customers money on the kit, so I would expect it to have a few more
facilities than your debugger, gcc, the debugger in MS VC++ or any other
debugger I have ever used.
(useful if
It will never work in the general case. It will work in very specific
situations when you know the code very well, and you understand
perfectly how the program works already.
Like most programmers, a large amount of the code I have worked on was
not written by me, including several where I worked very successfully
without using a debugger. Even where I did write some of the code, I was
often one of many people, often including people who had left the
company before I ever looked at the software in question. I was also
often "dropped in it" by being given stuff where I did not even know the
application domain, and sometimes did not even know the language (Coral
66). I never did learn Coral 66, although I had to debug programs
written in it a few times.
I do use debuggers and agree they are useful. However I have not used
them on all project and have done a lot of debugging by reading
documentation (to find out what the code was intended to do and how it
was intended to do it) and reading code and looking at the output and
doing reasoning.
Probably the hardest system I ever had to debug used 20 processor cores
and was doing real-time video processing, and I could not stop the
incoming video data. I tried using the debuggers (I could make a break
on one processor core cause all of them to halt) but often had to give
up with the debuggers and just sit down with reams of printouts
scrawling all over them to work out what was going on. I could not use
the debuggers for much because the debugger breaking the code (or single
stepping) broke the pipeline and changed the behaviour of the code (the
code relied on the documented behaviour of the pileline).