views:

839

answers:

6

Hello folks, Debug breakpoint's works fine in all other 38 units of my system. But, in my DataModule, that have +- 10.000 lines, delphi disables then after I launch by F9/F8/F7. In any part of source that unit, even on obrigatory steps like OnCreate, SQLConnection.Active:=true, etc. Detail: works fine until +- 20 days ago. I'm using D7 and have all sources of components also. Thanks Felipe

+3  A: 

Try doing a full build (Shift+F9). If that does not work, then what happens if you simulate a breakpoint in code with the below?

asm int 3 end;
JosephStyons
And if later you run your app and get an "Unhandled Exception 80000003", it's because you forgot to remove the above instruction. :-) Been there, done that, wore out the t-shirt.
Ken White
+3  A: 

Check for multiple copies of your source file for the datamodule. Sometimes the code you think you're running isn't the code the compiler and debugger are seeing.

Next, make sure you haven't accidentally turned off debugging in your code with {$D-} or {$DEBUGINFO OFF}. This can turn off debugging info for a single unit.

Also, make sure you've turned on Integrated Debugging in Tools|Options|Debugger Options. I know you said you could debug other places, but it can't hurt to make sure that integrated debugging didn't get accidentally turned off somehow.

Ken White
Thanks. But, there's only one copy of this file. Already found and erased all dcu's and recompile again.Already wrote {D+} directly in source code in this unit and project source file.
Felipe
Did you search your entire hard drive for the filename? And did you search all source for the switch turning debugging off, though? I doubt the file size is the issue, as I have a component library that contains a utility functions file that's 9000 lines and I can debug through it fine.
Ken White
Yes. I used Windows File Search and located every copy with the same name and deleted them. I made some "mistakes source codes" and recompile to verify which file is in use and the compiler report's error like expected.All other units from the same project run debug breakpoints fine
Felipe
Felipe: Add a ShowMessage('adsf'); in your OnCreate and compile again. When your message doesn't show up, you probably have multiple copies (maybe an old bpl file?), or the name of your class is not unique and another class is used from another unit. When you see your message then there is something with your debuginfo.
The_Fox
thanks Fox. I'm doing it for 20 day: using ShowMessage's to debug code in this unit, showing variable values, but is too hard.
Felipe
A: 

There's a blog post from Steve Trefethen, a while back, explaining some possible reasons, although if you say you can debug other units, I doubt they'll apply.

We had the same issue with a large DataModule in Delphi 5 that wouldn't let us debug it, and kind of put it down to it being too large a file to debug and Delphi not liking it. When we moved to Delphi 2007, we could debug it again. Not sure why, nothing had changed (code wise).

Pauk
Thanks. I read this article now and made some tests. Same behavior. I'll try to remove some code to other units and try again.
Felipe
A: 

Felipe, is the unit that will not allow you to debug in a dll that is being moved into or out of memory? I've found when debugging dll's that if I do something in the executable that executes code in another dll or unloads the dll that the problem unit is in - Delphi will disable all breakpoints. Usually a restart of Delphi and being sure to keep a single instance of the problem unit's dll in memory is the only solution for this problem.

I doubt size is the issue, as I have a 17k line unit that I debug regularly.

Thanks Doug. But, I don't use any dll or bpl. I have all sources of all components. This behavior occurs only in a DataModule of all program code.
Felipe
A: 

I have a vague memory that debugging very large files was buggy in old D7. Try to break you big unit in several classes and se if you can debug outside your unit. Another option could be to turn off debuginfo in your big file except the section you want to debug. It is worth a try.

Roland Bengtsson
Thanks. I'm trying this now. When I get some results, I'll post.
Felipe
A: 

Hello folks! I discovered this problem. It's a weird behavior in Delphi7 that limits the number of fields in interface class section, between: type TDM=class(TDataModule) and private section. I deleted some fields (DataSet Fields (+-40 fields)) and degub runs again. I add these fields again, and debug not runs. I'm sure that's a limit, because doesn't mather which component fields I deleted. I tried with several fields, from different tables too, adding, testing and deleting. It's a shame, but is true... Thanks for your help.

Felipe