Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 2.25 KB

exercises.org

File metadata and controls

57 lines (45 loc) · 2.25 KB

SCiP building and debugging exercises

Introduction

Return the exercises by email to [email protected] no later than 20.6.2016 9 o’clock (9 in the morning, that is).

To pass the course, you must score at least 50% of the maximum exercise score. Some of the exercises will likely be difficult if you’re not familiar with Linux system programming; however don’t be discouraged by this as the judging will take this into account and be correspondingly lenient.

Autotoolify

Given the source code files a.c, b.c, and b.h, which you can find at /scratch/scip/building, create an autotools project for building and distributing it. That is, the end result should be an archive file (.tar.gz or such) containing the three source files, a configure script, Makefile.am and configure.ac. The package should be installable in the usual way, that is:

./configure --prefix=/some/install_path; make; make install

Hint: See e.g. the guide at https://autotools.io. Note that if you have managed to setup your autotools project properly, you should be able to create the distribution package with make dist.

Debugging a segfault

Take a look at /scratch/scip/debug/boom.c. Use the debugging techniques covered in the lectures try to figure out what the fault is. When submitting the exercise, please provide a diff between the original version and your fixed version, e.g. run a command like

diff -up boom.c boom.working.c

Please also provide a written explanation describing what debugging approaches you tried and how you ultimately found the bug. Or if you didn’t find the bug, at least explain what you have done trying to find it!

Debugging a strangely behaving C program

Take a look at /scratch/scip/debug/opt.c. Compile and run it with different optimization levels (at least -O0 and -O2). You should see that it behaves differently depending on the optimization level. Clearly this is not a desirable state of affairs. Can you use the debugging techniques and tools covered in the lectures to figure out what happens and why? If not, do you have any other idea what might be wrong and what could be done about it?