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

Source string Read only

(itstool) path: listitem/para
Context English State
<prompt>%</prompt> <userinput>gdb <filename><replaceable>progname</replaceable></filename></userinput>
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc.
(gdb) <userinput>core <filename><replaceable>progname</replaceable>.core</filename></userinput>
Core was generated by `<filename><replaceable>progname</replaceable></filename>'.
Program terminated with signal 11, Segmentation fault.
Cannot access memory at address 0x7020796d.
#0 0x164a in bazz (anint=0x5) at temp.c:17
In this case, the program was called <filename><replaceable>progname</replaceable></filename>, so the core file is called <filename><replaceable>progname</replaceable>.core</filename>. We can see that the program crashed due to trying to access an area in memory that was not available to it in a function called <function>bazz</function>.
Sometimes it is useful to be able to see how a function was called, as the problem could have occurred a long way up the call stack in a complex program. <command>bt</command> causes <command>gdb</command> to print out a back-trace of the call stack:
(gdb) <userinput>bt</userinput>
#0 0x164a in bazz (anint=0x5) at temp.c:17
#1 0xefbfd888 in end ()
#2 0x162c in main () at temp.c:11
The <function>end()</function> function is called when a program crashes; in this case, the <function>bazz()</function> function was called from <function>main()</function>.
Attaching to a Running Program with gdb
One of the neatest features about <command>gdb</command> is that it can attach to a program that is already running. Of course, that requires sufficient permissions to do so. A common problem is stepping through a program that forks and wanting to trace the child, but the debugger will only trace the parent.
To do that, start up another <command>gdb</command>, use <command>ps</command> to find the process ID for the child, and do
(gdb) <userinput>attach <replaceable>pid</replaceable></userinput>
in <command>gdb</command>, and then debug as usual.
Now all that is needed is to attach to the child, set <symbol>PauseMode</symbol> to <literal>0</literal>, and wait for the <function>sleep()</function> call to return!
Using Emacs as a Development Environment
Emacs is a highly customizable editor—indeed, it has been customized to the point where it is more like an operating system than an editor! Many developers and sysadmins do in fact spend practically all their time working inside Emacs, leaving it only to log out.
It is impossible even to summarize everything Emacs can do here, but here are some of the features of interest to developers:
Very powerful editor, allowing search-and-replace on both strings and regular expressions (patterns), jumping to start/end of block expression, etc, etc.
Pull-down menus and online help.
Language-dependent syntax highlighting and indentation.
Completely customizable.
You can compile and debug programs within Emacs.
On a compilation error, you can jump to the offending line of source code.
Friendly-ish front-end to the <command>info</command> program used for reading GNU hypertext documentation, including the documentation on Emacs itself.
Friendly front-end to <command>gdb</command>, allowing you to look at the source code as you step through your program.
And doubtless many more that have been overlooked.
Emacs can be installed on FreeBSD using the <package>editors/emacs</package> port.
Once it is installed, start it up and do <literal>C-h t</literal> to read an Emacs tutorial—that means hold down <keycap>control</keycap>, press <keycap>h</keycap>, let go of <keycap>control</keycap>, and then press <keycap>t</keycap>. (Alternatively, you can use the mouse to select <guimenuitem>Emacs Tutorial</guimenuitem> from the <guimenu>Help</guimenu> menu.)
Although Emacs does have menus, it is well worth learning the key bindings, as it is much quicker when you are editing something to press a couple of keys than to try to find the mouse and then click on the right place. And, when you are talking to seasoned Emacs users, you will find they often casually throw around expressions like <quote><literal>M-x replace-s RET foo RET bar RET</literal></quote> so it is useful to know what they mean. And in any case, Emacs has far too many useful functions for them to all fit on the menu bars.
Fortunately, it is quite easy to pick up the key-bindings, as they are displayed next to the menu item. My advice is to use the menu item for, say, opening a file until you understand how it works and feel confident with it, then try doing C-x C-f. When you are happy with that, move on to another menu command.
If you cannot remember what a particular combination of keys does, select <guimenuitem>Describe Key</guimenuitem> from the <guimenu>Help</guimenu> menu and type it in—Emacs will tell you what it does. You can also use the <guimenuitem>Command Apropos</guimenuitem> menu item to find out all the commands which contain a particular word in them, with the key binding next to it.
By the way, the expression above means hold down the <keysym>Meta</keysym> key, press <keysym>x</keysym>, release the <keysym>Meta</keysym> key, type <userinput>replace-s</userinput> (short for <literal>replace-string</literal>—another feature of Emacs is that you can abbreviate commands), press the <keysym>return</keysym> key, type <userinput>foo</userinput> (the string you want replaced), press the <keysym>return</keysym> key, type bar (the string you want to replace <literal>foo</literal> with) and press <keysym>return</keysym> again. Emacs will then do the search-and-replace operation you have just requested.
If you are wondering what on earth <keysym>Meta</keysym> is, it is a special key that many <trademark class="registered">UNIX</trademark> workstations have. Unfortunately, PC's do not have one, so it is usually <keycap>alt</keycap> (or if you are unlucky, the <keysym>escape</keysym> key).


No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: listitem/para
Source string location
String age
a year ago
Source string age
a year ago
Translation file
books/developers-handbook.pot, string 416