-1

I am trying to modify some open source code, but I having trouble approaching how to do so

The open source program that I am working with is called lessfs, and it has about four C files with up to 3000 lines of code. I am only concerned with one portion of the source code in order to modify.

Therefore, my question is, if I would like to add some print statements inside the code, how would I be able to see it?

Would I have to run the program or compile the program and run them individually? Or would it just be better to email the author and figure out a way to see certain items being printed while the program is running?

I have tried using GDB, but how do you do that when you are dealing with multiple large files?

I posted another form similar to this here:

Thanks for your time in advance

Also, for more information about the source code that I am working with can be found here:

http://www.lessfs.com/wordpress/

Community
  • 1
  • 1
humblebeast
  • 303
  • 3
  • 16
  • What do you mean with "how would I be able to see it?"? Would printed information not always pop up on your console, as they usually do? – Jongware Jul 09 '14 at 17:39
  • I would like to see specific attributes in the program being printed while it is running, so I added print statements, but nothing is being printed (that I added in the source code) when I run the program, do I have to compile that specific C file that I am working with individually? Or should I just contact the author on about how I might be able to do that – humblebeast Jul 09 '14 at 18:34

1 Answers1

0

If you add some print statement you have to compile the program again and then run it in order to see the printed text. I think this is obvious for a compiled languages.

Instead of print statements use GDB with breakpoints in order to inspect the values of the variables or the flow of the program.

alepapadop
  • 36
  • 4
  • Yes, I know how to do that when I am running my own files, but how do I do that when this source code has a bunch of .h files and other C programs that are required for the program to run? – humblebeast Jul 09 '14 at 18:39
  • @humblebeast, Write a makefile or create a project in an IDE and add those files (the IDE will generate the makefile for you). – sherrellbc Jul 09 '14 at 18:46
  • Ok, I will try the C version of Eclipse to run this program, try debugger to hopefully trace the methods and then eventually create a makefile; although, what does a makefile exactly help with? – humblebeast Jul 09 '14 at 18:53
  • An IDE will make the job but if you have enough time i recommend you to study cmake http://www.cmake.org/. – alepapadop Jul 09 '14 at 19:51