The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: sect2/para
Context English State
The secret lies in the last line, which tells <command>make</command> to look in the system makefile called <filename></filename>. It is easy to overlook this line, but this is where all the clever stuff comes from—someone has written a makefile that tells <command>make</command> to do all the things above (plus a couple of other things I did not mention, including handling any errors that may occur) and anyone can get access to that just by putting a single line in their own make file!
If you want to have a look at these system makefiles, they are in <filename>/usr/share/mk</filename>, but it is probably best to wait until you have had a bit of practice with makefiles, as they are very complicated (and if you do look at them, make sure you have a flask of strong coffee handy!)
More Advanced Uses of <command>make</command>
<command>Make</command> is a very powerful tool, and can do much more than the simple example above shows. Unfortunately, there are several different versions of <command>make</command>, and they all differ considerably. The best way to learn what they can do is probably to read the documentation—hopefully this introduction will have given you a base from which you can do this.
The version of make that comes with FreeBSD is the <application>Berkeley make</application>; there is a tutorial for it in <filename>/usr/share/doc/psd/12.make</filename>. To view it, do
<prompt>%</prompt> <userinput>zmore paper.ascii.gz</userinput>
in that directory.
Many applications in the ports use <application>GNU make</application>, which has a very good set of <quote>info</quote> pages. If you have installed any of these ports, <application>GNU make</application> will automatically have been installed as <command>gmake</command>. It is also available as a port and package in its own right.
To view the info pages for <application>GNU make</application>, you will have to edit <filename>dir</filename> in the <filename>/usr/local/info</filename> directory to add an entry for it. This involves adding a line like
* Make: (make). The GNU Make utility.
to the file. Once you have done this, you can type <userinput>info</userinput> and then select <guimenuitem>make</guimenuitem> from the menu (or in <application>Emacs</application>, do <userinput>C-h i</userinput>).
Introduction to Available Debuggers
Using a debugger allows running the program under more controlled circumstances. Typically, it is possible to step through the program a line at a time, inspect the value of variables, change them, tell the debugger to run up to a certain point and then stop, and so on. It is also possible to attach to a program that is already running, or load a core file to investigate why the program crashed. It is even possible to debug the kernel, though that is a little trickier than the user applications we will be discussing in this section.
This section is intended to be a quick introduction to using debuggers and does not cover specialized topics such as debugging the kernel. For more information about that, refer to <xref linkend="kerneldebug"/>.
The standard debugger supplied with FreeBSD 12.1 is called <command>lldb</command> (<application>LLVM debugger</application>). As it is part of the standard installation for that release, there is no need to do anything special to use it. It has good command help, accessible via the <userinput>help</userinput> command, as well as <link xlink:href="">a web tutorial and documentation</link>.
The <command>lldb</command> command is available for FreeBSD 11.3 <link xlink:href="@@URL_RELPREFIX@@/doc/en_US.ISO8859-1/books/handbook/ports-using.html">from ports or packages</link> as <package>devel/llvm</package>. This will install the default version of lldb (currently 9.0).
The other debugger available with FreeBSD is called <command>gdb</command> (<application>GNU debugger</application>). Unlike lldb, it is not installed by default on FreeBSD 12.1; to use it, <link xlink:href="@@URL_RELPREFIX@@/doc/en_US.ISO8859-1/books/handbook/ports-using.html">install</link> <package>devel/gdb</package> from ports or packages. The version installed by default on FreeBSD 11.3 is old; instead, install <package>devel/gdb</package> there as well. It has quite good on-line help, as well as a set of info pages.
Which one to use is largely a matter of taste. If familiar with one only, use that one. People familiar with neither or both but wanting to use one from inside <application>Emacs</application> will need to use <command>gdb</command> as <command>lldb</command> is unsupported by <application>Emacs</application>. Otherwise, try both and see which one you prefer.
Using lldb
Starting lldb
Start up lldb by typing
<prompt>%</prompt> <userinput>lldb -- <replaceable>progname</replaceable></userinput>
Running a Program with lldb
Compile the program with <option>-g</option> to get the most out of using <command>lldb</command>. It will work without, but will only display the name of the function currently running, instead of the source code. If it displays a line like:
Breakpoint 1: where = temp`main, address = …
(without an indication of source code filename and line number) when setting a breakpoint, this means that the program was not compiled with <option>-g</option>.
Most <command>lldb</command> commands have shorter forms that can be used instead. The longer forms are used here for clarity.
At the <command>lldb</command> prompt, type <userinput>breakpoint set -n main</userinput>. This will tell the debugger not to display the preliminary set-up code in the program being run and to stop execution at the beginning of the program's code. Now type <userinput>process launch</userinput> to actually start the program— it will start at the beginning of the set-up code and then get stopped by the debugger when it calls <function>main()</function>.
To step through the program a line at a time, type <userinput>thread step-over</userinput>. When the program gets to a function call, step into it by typing <userinput>thread step-in</userinput>. Once in a function call, return from it by typing <userinput>thread step-out</userinput> or use <userinput>up</userinput> and <userinput>down</userinput> to take a quick look at the caller.
Here is a simple example of how to spot a mistake in a program with <command>lldb</command>. This is our program (with a deliberate mistake):


New source string 7 months ago
Browse all component changes

Source information

Source string comment
(itstool) path: sect2/para
Source string location
String age
7 months ago
Source string age
7 months ago
Translation file
books/developers-handbook.pot, string 321