The inspiration for writing this article was obtained after reading a similar publication for the x86 architecture .
This material will help those who want to understand how the programs are built from the inside, what happens before entering the main and why all this is done. Also I'll show you how to use some of the features of the glibc library. And in the end, as in the original article , the traversed path will be visually represented. Most of the article is a parsing of the glibc library.
So, let's start our trip. We will use Linux x86-64, and as a debugging tool - lldb. Also sometimes we will disassemble the program with objdump.
The source text is normal Hello, world (hello.cpp):
std::cout << "Hello, world!" << std::endl;
Microsoft Dynamics CRM – An Overview
Microsoft Dynamics CRM is a complete CRM software suite that covers all areas of customer service including sales and marketing. MS-Officeand Outlook are some of the commonly used office applications for word processing and emailing.
With MS Dynamics CRM software, customer data can easily be pulled in these office applications and you can even work within the familiar background of Microsoft Office or Outlook. The support for mobile devices and data access on the go, make life easier for sales and marketing executives.
The flexibility and comprehensiveness of Microsoft Dynamics CRM suite make it a popular CRM application development framework worldwide. Minimal configuration, familiar application environment, rich functionality, and a variety of deployment options are some of the features that ensure great ease of use and customization.
As you know, our main activity is development of the code analyzers PVS-Studio and CppCat. Although we have been doing this for a long time now and - as we believe - quite successfully, an unusual idea struck us recently. You see, we do not use our own tools in exactly the same way our customers do. Well, we analyze the code of PVS-Studio by PVS-Studio of course, but, honestly, the PVS-Studio project is far from large. Also, the manner of working with PVS-Studio's code is different from that of working with Chromium's or LLVM's code, for example.
We felt like putting ourselves in our customers' shoes to see how our tool is used in long-term projects. You see, project checks we regularly do and report about in our numerous articles are done just the way we would never want our analyzer to be used. Running the tool on a project once, fixing a bunch of bugs, and repeating it all again just one year later is totally incorrect. The routine of coding implies that the analyzer ought to be used regularly - daily.
OK, what's the purpose of all that talk? Our theoretical wishes about trying ourselves in third-party projects have coincided with practical opportunities we started to be offered not so long ago. Last year we decided to allocate a separate team in our company to take up - ugh! - outsourcing; that is, take part in third-party projects as a developer team. Moreover, we were interested in long-term and rather large projects, i.e. requiring not less than 2-3 developers and not less than 6 months of development. We had two goals to accomplish:
- try an alternative kind of business (custom development as opposed to own product development);
- see with our own eyes how PVS-Studio is used in long-term projects.
I have studied numbers of errors caused by using the Copy-Pate method and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have never seen this phenomenon described in books on programming, so I decided to write about it myself. I called it the "last line effect".
Perhaps, this article may not present any new or fresh ideas, besides, I'm sure you have often read something like this somewhere else. This post even does not claim the fact to be true. Its content is the fruit of my own experience, mistakes, and the knowledge that I have gotten from my colleagues. I'm sure that many people will be able to find themselves in my article. Probably, the first stage is not very typical for the programmers who are not involved in the Olympic programming, but the following stages do not independent from this factor at all.
Just recently I've checked the VirtualDub project with PVS-Studio. This was a random choice. You see, I believe that it is very important to regularly check and re-check various projects to show users that the PVS-Studio analyzer is evolving, and which project you run it on doesn't matter that much - bugs can be found everywhere. We already checked the VirtualDub project in 2011, but we found almost nothing of interest then. So, I decided to take a look at it now, 2 years later.
I downloaded the archive VirtualDub-1.10.3-src.7z from the VirtualDub website. Analysis was performed by PVS-Studio 5.10. It took me just about one hour, so don't be strict with me. I surely must have missed something or, on the contrary, taken correct code fragments for incorrect ones. If you develop and maintain the VirtualDub project, please don't rely on my report - check it yourselves. We always help the open-source community and will grant you a registration key.
I'm also asking Avery Lee to get me right. Last time his reaction to my mentioning VirtualDub in one of the articles was pretty negative. I never mean to say about any program that it's buggy. Software errors can be found in every program. My goal is to show how useful the static code analysis technology can be. At the same time, it will help to make open-source projects a bit more reliable. And that's wonderful.
In this article I'm going to discuss a problem few people think of. Computer simulation of various processes becomes more and more widespread. This technology is wonderful because it allows us to save time and materials which would be otherwise spent on senseless chemical, biological, physical and other kinds of experiments. A computer simulation model of a wing section flow may help significantly reduce the number of prototypes to be tested in a real wind tunnel. Numerical experiments are given more and more trust nowadays. However, dazzled by the triumph of computer simulation, nobody notices the problem of software complexity growth behind it. People treat computer and computer programs just as a means to obtain necessary results. I'm worried that very few know and care about the fact that software size growth leads to a non-linear growth of the number of software bugs. It's dangerous to exploit a computer treating it just as a big calculator. So, that's what I think - I need to share this idea with other people.
Not so long ago one of our colleagues left the team and joined one company developing software for embedded systems. There is nothing extraordinary about it: in every firm people come and go, all the time. Their choice is determined by bonuses offered, the convenience aspect, and personal preferences. What we find interesting is quite another thing. Our ex-colleague is sincerely worried about the quality of the code he deals with in his new job. And that has resulted in us writing a joint article. You see, once you have figured out what static analysis is all about, you just don't feel like settling for "simply programming".
TDD is one of the most popular software development techniques. I like this technology in general, and we employ it to some extent. The main thing is not to run to extremes when using it. One shouldn't fully rely on it alone forgetting other methods of software quality enhancement. In this article, I will show you how the static code analysis methodology can be used by programmers using TDD to additionally secure themselves against errors.
TDD is wonderfulTest-driven development (TDD) is a technique of software development based on iteration of very short development cycles. You write a test first which covers the change you want to introduce, then you write a code to pass the test, and finally you carry out refactoring of the new code to meet the corresponding standards. I won't dwell on what TDD is: there exist many articles on this subject which you can easily find on the Internet.
I'm joking about Linux, of course. Nevertheless, this question really interests me. I understand that systems they work on in Microsoft are large and complex. I know very well that bugs may be detected by users only some time later after release. But I don't understand how can one simply not notice obvious bugs in the tools the developers themselves are meant to use regularly?
A few words about classic mistakes to start with. Everything's clear about them: developers may well miss them because they are not the end users. A good example of this is an error in one of the Microsoft Visio versions. It was the 2010 version, I suppose. When you started typing text in Russian into a Basic Flowchart block, it was being typed back to front. I can understand it. Someone has mixed up things and decided that words are written from right to left in the Russian language. Russian and Arabic are absolutely the same, or very similar at least. There were no Russians among testers, and the error got into the release version. I can understand this case.