-1

I searched for a solution to my problem already in Google and here in stack overflow. I didn't found an understandable and precise solution for my problem:

I've written a program that maintains an inventory. It compiled without warnings or errors and it works quite well when I type in commands by hand. When I'm running the program with an input file with much more parts I get a segmentation fault 11.

Now I want to debug my program but don't know how to do this using input files. I already did some debugging via the CodeBlocks IDE. Didn't find a option for this.

I used malloc and realloc functions in my program and think the error happened there because I never used it before.

Could you please help me in following ways:

  1. I need a debugger that can debug while the program runs with an input file.
  2. The debugger must be able to check for memory leaks or things like this.

Thanks Armin

Mahonri Moriancumer
  • 5,993
  • 2
  • 18
  • 28
Armin
  • 19
  • 2

1 Answers1

0

Debugging with command line input vs. Debugging with a input file is the totally same.

You must understand this.

When you start debugging session in the IDE, it is by default 'no input' mode (no input file).

But you can specify startup conditions for the program, including working directory, command line arguments, etc.

By using these options, you can run the debugging session exactly same as user running the program with input files.

9dan
  • 4,222
  • 2
  • 29
  • 44
  • Thanks for your answer. This created new problems, I saw that on my mac gdb is not installed. Codeblocks uses gdb for debugging but it's not available for OS X mavericks. Do you have a recommendation which debugger I should use otherwise? – Armin May 16 '14 at 05:46
  • @Armin I hope this post helps: http://stackoverflow.com/questions/19554439/gdb-missing-in-os-x-mavericks – 9dan Oct 03 '14 at 15:37