Valik Posted May 24, 2011 Posted May 24, 2011 Maybe it's one of those bugs where it's always been broken and some in memory buffer has moved with the new compiler and a previously unseen memory problem is showing up. I hate those.No, the crash happens in the changes I made the other day but I can't figure out why. A std::vector is becoming corrupt for no reason I can determine. I reverted my changes and used const_cast to silence the compiler errors and the code worked using the original std::set. Definitely related to my changes but I've no clue why. I do have a couple things to try when I find time but if that doesn't fix it we may have to go with the nasty const_cast version until I can determine what the code is supposed to do so it can be re-written
jaberwacky Posted May 24, 2011 Posted May 24, 2011 Thanks Jos and BrewManNH. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
jchd Posted May 24, 2011 Posted May 24, 2011 It's a pity that valgrind doesn't exist for Windows OSes. OTOH AutoIt definitely is way too Windows dependent to have any hope using such a valuable tool. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Richard Robertson Posted May 24, 2011 Posted May 24, 2011 Valgrind is a source code bug finder right? Should things like this even exist?
Administrators Jon Posted May 24, 2011 Author Administrators Posted May 24, 2011 No, the crash happens in the changes I made the other day but I can't figure out why. A std::vector is becoming corrupt for no reason I can determine. I reverted my changes and used const_cast to silence the compiler errors and the code worked using the original std::set. Definitely related to my changes but I've no clue why. I do have a couple things to try when I find time but if that doesn't fix it we may have to go with the nasty const_cast version until I can determine what the code is supposed to do so it can be re-writtenI assume that set wasn't used in our code because of the properties mentioned here?: http://stackoverflow.com/questions/3704273/c-dequeue-vs-vector-and-c-map-vs-set (uniqueness, order, etc). Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
jchd Posted May 24, 2011 Posted May 24, 2011 Indeed valgrind act as magic and is able to spot incredibly subtle causes, right. What is not working is Debug buttons of any dev environment. Choose any buggy code as source and hit Debug: code is still buggy afterwards. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Valik Posted May 24, 2011 Posted May 24, 2011 I assume that set wasn't used in our code because of the properties mentioned here?: http://stackoverflow.com/questions/3704273/c-dequeue-vs-vector-and-c-map-vs-set (uniqueness, order, etc).I suspect it was originally a set because sets are implemented as binary trees which means they are speedy. Also it appears to have the same interface as the object using the set so I think that was also a factor.I think I'm going about the problem wrong. Maybe the code should be using a set and returning references instead of pointers. Probably require more changes to the code but I think it's probably the correct way.
Richard Robertson Posted May 24, 2011 Posted May 24, 2011 Indeed valgrind act as magic and is able to spot incredibly subtle causes, right.What is not working is Debug buttons of any dev environment. Choose any buggy code as source and hit Debug: code is still buggy afterwards.It shouldn't be the software's job to make sure other software works. That's what you pay a programmer for.
jaberwacky Posted May 24, 2011 Posted May 24, 2011 For what it's worth here is my bug report. Don't cancel your wedding or your child's birthday party. $oObject.Example.Example() has odd colorings. The first example is bold blue and the second example is plain black text. The '.E' in the second is another color altogether. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
Valik Posted May 24, 2011 Posted May 24, 2011 It shouldn't be the software's job to make sure other software works. That's what you pay a programmer for.So I should get rid of the Visual Studio debugger, then?Really, Richard, you say some dumb things sometimes but you're really saying some incredibly dumb things today.
Richard Robertson Posted May 24, 2011 Posted May 24, 2011 (edited) Visual Studio's debugger doesn't solve any problems. Or any debugger for that matter. Edited May 24, 2011 by Richard Robertson
Valik Posted May 25, 2011 Posted May 25, 2011 Visual Studio's debugger doesn't solve any problems. Or any debugger for that matter.It solves a crucial problem: Where the fuck is my code crashing.
monoceres Posted May 25, 2011 Posted May 25, 2011 It solves a crucial problem: Where the fuck is my code crashing.I cannot express in words how true this is. Broken link? PM me and I'll send you the file!
Richard Robertson Posted May 25, 2011 Posted May 25, 2011 (edited) It solves a crucial problem: Where the fuck is my code crashing.It gives you the runtime situation but it doesn't just read the code and say "right here dumbass."Not calling you one, but that's how you'd feel if a program just pointed out your errors for you. Edited May 25, 2011 by Richard Robertson
Valik Posted May 25, 2011 Posted May 25, 2011 It gives you the runtime situation but it doesn't just read the code and say "right here dumbass."Not calling you one, but that's how you'd feel if a program just pointed out your errors for you.In some cases, yes it does. Seeing which line the crash happens on is often enough to know why the crash exists. Anyway, I feel SOOOO much better when I spend a half hour going through my code to find the dumbass mistake myself. Sorry, but if I had something that could go through my code and tell me where the errors were BEFORE shipping and WITHOUT spending hours looking for it after-the-fact, then I'll take it.You're not going to win this, Richard. You're comment was just plain idiotic. You show many any programmer and you've shown me a programmer who makes mistakes. Some of those mistakes can be easily caught by software-based tools looking for them. Have you ever use Au3Check even once in your life? Guess what it is: A tool to detect mistakes in your code. Sometimes we make typos in otherwise fundamentally sound pieces of code. Sometimes we accidentally type "=" when we mean "==". Sometimes we get in a hurry and forget to add that call to delete. It happens, it doesn't mean we are bad programmers. Should we ship a product with bugs just because we're too proud to use tools to detect them? I feel more like a dumbass that AutoIt was shipped with a blindingly obvious memory leak in FileOpen() than I ever would having such an error pointed out to me by software. Keep in mind I feel that way and it wasn't even code I touched. Hell, the C++ compiler is a tool that helps detect bugs, there are many cases where it will issue a warning for otherwise working but less than ideal code. I guess we shouldn't use the compiler, either?Any tool that exists to ensure the programmer does not make mistakes and to assist the programmer in correcting mistakes is a good thing. Anybody who says otherwise is not someone worth listening to. Full stop.
Richard Robertson Posted May 25, 2011 Posted May 25, 2011 You know, I'm reading over this today and I can't figure out why I post things like that.
Valik Posted May 25, 2011 Posted May 25, 2011 Au3Check should no longer crash in the next release. Hopefully it still functions correctly otherwise...
Administrators Jon Posted May 25, 2011 Author Administrators Posted May 25, 2011 Au3Check should no longer crash in the next release. Hopefully it still functions correctly otherwise...Great, thanks. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
jchd Posted May 25, 2011 Posted May 25, 2011 I've found this reading to be very enlightning about common pitfalls in C[++], providing lights about "it worked with previous releases of the same compiler" issues and much more.It shows how seamingly correct simple code can turn into something you'd never expect.A must read, that you write C[++] occasionally or 10 hours a day. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Recommended Posts