1

There is an old application crashing due to heap corruptions and we want to investigate it. At the moment, dumps are created after every crash but the problem is that heap corruptions do not necessarily crash the application the moment it happens. I want to create an informative dump the moment a heap corruption occurs (using GFlags) even if doesn't crash the application.

To test the GFlags functionality I'm writing a simple CPP application. I'm trying to stimulate a simple heap corruption that doesn't necessarily crash the application and see that a dump is created. However, I have no knowledge in CPP and I can't find a simple example for such corruption which will prove me that GFlags works and does create a dump the moment the heap corruption occurs.

Is there a quick example that could help me?

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • 6
    Have you tried using a memory debugger such as [Valgrind](http://valgrind.org/) (or similar) to help you find where it happens? – Some programmer dude Mar 14 '17 at 15:28
  • What about accessing an array element outside of the array's bounds? – bweber Mar 14 '17 at 15:31
  • @Some Programmer dude. At the moment no, I just want to test the GFlags functionality. –  Mar 14 '17 at 15:36
  • Accessing an array element outside of the array's bounds would throw an exception right away. I want it stimulate our application which sometimes doesn't crush right away –  Mar 14 '17 at 15:37
  • @S.Peter Regarding out-of-bounds access, remember that C++ have no bound-checking. If you access an array out of bounds you have *undefined behavior*, but what will happen is, well, *undefined*. – Some programmer dude Mar 14 '17 at 15:40
  • Techology mismatch detected: GFlags is not a Visual C++ tool, and doesn't give a hoot about the C++ heap. It's a Windows tool, and cares about the process heaps. (Windows allows a process to have multiple heaps). This also means GFlags doesn't care or know your program is written in C++. – MSalters Mar 14 '17 at 17:30
  • C++ Isn't the important part here. I'm just trying to see if the GFlags works before I send it out. How can I check if it works other than trying it real time? –  Mar 15 '17 at 13:08
  • GFlags is a very broad term. Which flags of GFlags do you want to enable? – Thomas Weller Mar 18 '17 at 19:44
  • @MSalters: you said: "GFlags is not a Visual C++ tool". I wondered who made such a statement, because it's not in the question. But ok, doesn't really matter. – Thomas Weller Mar 19 '17 at 16:23
  • @ThomasWeller: Well, it's not a mingw tool either, or an ICC tool. But GFlags is a Microsoft tool, and Visual Studio is a Microsoft product which ships with multiple tools, so that specific confusion is far more common. – MSalters Mar 20 '17 at 07:35

0 Answers0