Hi All!
I have a rather large project that I have been refactoring from an
earlier version that works. It is implemented in Laz 1.6.2. The new
version takes considerable advantage of generics (which I learned first
from Ada in the 1970s, then from C++ in the 1980s). The resulting code
is much smaller and cleaner than the old code.
During the development process I noticed some strangeness while
debugging. Frequently I will step through code and the debugger behaves
as if recent changes have not been made (even though the source shows
the changes). This has cost me days of debugging before the problem
/miraculously /seems to be cured. In other words I could not figure out
why all of my earlier edits seemed to take effect without my doing
anything explicitly to fix the problem. (One other side effect is that
gdb will occasionally crash when I let the mouse hover over certain
identifiers after a breakpoint).
I have finally discovered the apparent cause and a magic (but annoying)
workaround.
The steps in the cause:
A)
a1) Edit a library routine that contains generic code.
a2) Run with or without Debug. (The IDE recompiles the library first).
The code executes as if the edits never were made.
or
B)
b1) Edit a library routine that contains generic code.
b2) Compile the library using the Library Inspector.
b3) Run with or without Debug. The code executes as if the edits never
were made.
The magic workaround is very simple:
C)
c1) Edit a library routine that contains generic code.
c2) Compile the library using the Library Inspector.
*c3) Build the program using "Run | Cleanup and build..." or sometimes
just "Run | Build"* (I haven't found a pattern to decide which needs to
be used so I currently use the Cleanup and build option).
c4) Run with or without Debug. The edited code executes as written.
Note that the workaround is only necessary if the library's generic code
is edited. If the generic code is in the main code tree, the normal
process of edit, run, debug, ... builds and runs correctly.
I think the problem is that the modules in the main source tree that
instantiate the generics are not being updated unless the project is
re-built explicitly (why? I don't know).
I will try to submit a bug report with a sample project after my current
refactoring job is done (tight schedule, needs to be installed by the
end of June).
Don Ziesig
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus