www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Share a bug..

reply "Regan Heath" <regan netwin.co.nz> writes:
I work in C for a living.

I've just now fixed a bug which could be the poster child for D's  
auto-initialisation of variables. Allow me to describe the situation:

The customer reported odd behaviour for user X, but no others.

My initial reaction was to attempt to re-create locally, using customers  
configs and data ... no such luck.

I then obtained access to the customers machine and replicated the bug  
there, confirmed.

Checking the logs showed some odd data, so I enabled the "debug" logging  
repeated the test ... the bug vanished.

Setting logging back to "info" level I tried it again ... the bug is back.

I repeated those last two steps a few times, unable to believe what I was  
seeing.

I obtained permission to upload and test patched binaries.

To cut a long story short I elevated selected log lines from debug to  
info, and added additional logging (during which I found that elevating  
some log lines made the bug vanish again!)

Eventually, more luck than anything else, I spotted the bug.. I was using  
an un-initialised variable. What must have been happening was that the  
logging was modifying the memory on the stack, in which the variable was  
later being placed.

Regan
Mar 17 2005
next sibling parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Regan Heath wrote:
<snip>
 Eventually, more luck than anything else, I spotted the bug.. I was 
 using an un-initialised variable. What must have been happening was 
 that the logging was modifying the memory on the stack, in which the 
 variable was later being placed.

I think it happens to a lot of us some of the time. http://www.foldoc.org/?heisenbug Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Mar 18 2005
prev sibling next sibling parent =?iso-8859-1?q?Knud_S=F8rensen?= <12tkvvb02 sneakemail.com> writes:
Valgrind is great for finding this type of bugs.
http://valgrind.org/
Mar 18 2005
prev sibling parent reply Rox271 <rox271 yahoo.com> writes:
The latest version of Visual C++.NET tells you, during execution, that a 
variable was used prior to initialization.
Mar 19 2005
parent reply "Alexander Panek" <alexander.panek brainsware.org> writes:
On Sun, 20 Mar 2005 02:11:51 +0100, Rox271 <rox271 yahoo.com> wrote:

 The latest version of Visual C++.NET tells you, during execution, that a  
 variable was used prior to initialization.

you didn`t forget in which newsgroup you are atm ? -- huh? did you say something? :o
Mar 20 2005
parent reply Rox271 <rox271 yahoo.com> writes:
Alexander Panek wrote:
 you didn`t forget in which newsgroup you are atm ?
 

Hehe no, I didn't. But since Regan is writing C for a living, I wanted to give him a clue about how to survive. And more generally, would you choose D for a commercial application? This goes back to my earlier questions about D maturity. Sorry for my unclear comment, I don't mean to "troll" this newsgroup.
Mar 20 2005
parent reply "Regan Heath" <regan netwin.co.nz> writes:
On Sun, 20 Mar 2005 21:35:53 +0100, Rox271 <rox271 yahoo.com> wrote:
 Alexander Panek wrote:
 you didn`t forget in which newsgroup you are atm ?

Hehe no, I didn't. But since Regan is writing C for a living, I wanted to give him a clue about how to survive.

I'm doin alright. :) To be honest I haven't tried valgrind, lint, or the latest .NET IDE for C development, I probably should.
 And more generally, would you choose D for a commercial application?
 This goes back to my earlier questions about D maturity.

Personally, not yet. It seems every time I try to write some serious code I hit a limitation or bug. In addition abd integrated IDE/debugger enviroment like Visual Studio would be "nice" but isn't essential.
 Sorry for my unclear comment, I don't mean to "troll" this newsgroup.

I took your comment as "helpful advice". I took Alexanders reply as "humourous interjection". I try to take the best possible interpretation of every post that I read. Regan
Mar 20 2005
parent reply Georg Wrede <georg.wrede nospam.org> writes:
Regan Heath wrote:
 In addition abd integrated 
 IDE/debugger  enviroment like Visual Studio would be "nice" but isn't 
 essential.

Several of the companies I've introduced D to, have said that (in addition to the [to us known immaturity issues]) one big reason for not taking up D is the lack of project management automation. They say, this usually comes with a professional grade IDE. Increasingly, I keep hearing, that the IDE of choice would be Eclipse. Reasons stated are, it's taking over the professional scene, is vendor independent, and has a huge and growing set of plugins. I also hear rumors that the work required to get Eclipse to work with D would be less than one'd expect. [Whatever that may mean...] One strong point they seem to agree on, is that changing the language should not force you to change the IDE. Programmer productivity seems to go down more with a change of IDE than with a change between related languages. [Which I take as between C, C++, Java, D, etc.] So, they'd love to use only one IDE. -------------- While I'd personally not use Eclipse because it would be overkill for my current work, I can understand their point. If this is the majority feeling in corporate app development, then I guess we'll see one IDE taking over the entire field. Programmers changing jobs, and companies offering jobs, would both become more attractive with the IDE "everybody else" uses.
Mar 21 2005
parent reply pragma <pragma_member pathlink.com> writes:
In article <423EF517.3030304 nospam.org>, Georg Wrede says...
Increasingly, I keep hearing, that the IDE of choice would be Eclipse. 
Reasons stated are, it's taking over the professional scene, is vendor 
independent, and has a huge and growing set of plugins.

It's true. At work many of us are moving toward Eclipse, one by one, away from ColdFusion Studio and Dreamweaver. The motivation is that we write Real Code(tm) and find Macromedia's Fireworks and such get in the way. I'll add that the ol' ColdFusion Studio is a sub-par IDE that is a full-step beind the latest CF implementation. Also, ColdFusion MX is Java-based, and we find ourselves writing more Java code all the time; so one-stop editing is a huge plus. In contrast, Eclipse is a very slick IDE, and is at least as capable as Visual Studio. The only drawback I've found is that it can be a real resource hog due to the Java runtime. Paging that monster in from disk can takes an enternity under the right situations (AFIAK: my system at work is likely misconfigured and has some performance issues). I agree that stronger support for D under Eclipse could only help. Given the inroads that Eclipse has made, D could ride its coattails to success quite easily (and take any would-be implementors along with it). Georg, what exactly do your superiors mean by "automation". Are we talking about nightly builds, or something more sophisticated? - EricAnderton at yahoo
Mar 21 2005
parent Georg Wrede <georg.wrede nospam.org> writes:
pragma wrote:
 
 In contrast, Eclipse is a very slick IDE, and is at least
 as capable as VisualStudio.  

Yes, that's one thing I forgot to mention. One of these firms is a long time VS user, but they are now switching to Eclipse.
 The only drawback I've found is that it can be a real resource
  hog due to the Java runtime.

That is one _excellent_ example of things where Java is used when actually D would do the job much better!
 I agree that stronger support for D under Eclipse could only help. 
 Given the inroads that Eclipse has made, D could ride its coattails quite
 to success easily (and take any would-be implementors along with it).

Couldn't have said it better!
 Georg, what exactly do your superiors mean by "automation".  Are
 we talking about nightly builds, or something more sophisticated?

Ehh, they are my _clients_. ;-) Anyhow, on the boss-level, the idea seemed to be, that _not_ having an IDE results in project directory hierarchies that are hard to manage (on the corporate level, at least), people "forgetting" to use the versioning system, (and, for some reason I forgot to ask) inferior code quality. Also, finding all files that belong to a project is harder for the next programmer. All in all, I guess the word "automation" meant here that things get done "right", or at least predictably. These bosses see this as very important. They also said that quite a few programmers don't want to use an IDE, but having it as Company Policy is the remedy for that. Especially those who don't want to use an IDE are often the guys who do things unnecessarily in "non-standard" ways, thus eroding overall cost-efficiency.
Mar 22 2005