GCCSDK build debugging tips

From RISC OS
Jump to navigationJump to search

Here may be found a collection of tips regarding debugging complex build processes, such as those used by GCCSDK and the autobuilder. Feel free to add more!

Program X in the build process seems to be hanging

One thing you can do to debug something like this is to use 'strace'. When doing something like 'strace ls' it tells you all the system calls that the program makes (lots and lots of output to stderr). It's quite handy for finding that a program is stalling on a particular call, or similar.

If you can hack around the Makefile to insert something like:

strace -f somecommand someoptions 2> /tmp/strace.log                                                                      
                                                                                                                        

around an existing command "somecommand someoptions" it might give you some more information to track it down further.

I want to know how program X is being called

A user reported their build was hanging with the program 'tic' taking 100% of CPU.

$ which tic
/usr/bin/tic

tells you that the program 'tic' with your current $PATH may be found at /usr/bin/tic.

If the machine isn't shared with other users you can replace tic temporarily with something that tells you what arguments it's called with so you can run it by hand:

$ sudo mv /usr/bin/tic /usr/bin/tic-tmp                                                                                   
$ sudo cat > /usr/bin/tic                                                                                                 
#!/bin/sh                                                                                                                 
                                                                                                                          
echo $* > /tmp/tic.log                                                                                                    
/usr/bin/tic-tmp $*                                                                                                       
[Ctrl-D]                                                                                                                  
$ sudo chmod +x /usr/bin/tic                                                                                              
                                                                                                                         

You'll find the parameters being output in /tmp/tic.log Don't forget to move /usr/bin/tic-tmp back to /usr/bin/tic when you've finished!