Translation

<prompt>%</prompt> <userinput>gdb a.out<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 a.out.core</userinput>
Core was generated by `a.out
<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
(gdb)
(itstool) path: sect3/screen
<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
(gdb)
568/7210
Context English Portuguese (Brazil) State
At the <command>gdb</command> prompt, type <userinput>break main</userinput>. This will tell the debugger to skip 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>run</userinput> to 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>.
No <command> gdb </command> prompt, digite <userinput> quebrar principal </userinput> . Isso dirá ao depurador que você não está interessado em observar o código de configuração preliminar no programa que está sendo executado e que ele deve interromper a execução no início de seu código. Agora digite <userinput> corre </userinput> para iniciar o programa - ele será iniciado no início do código de configuração e, em seguida, será interrompido pelo depurador quando ele for chamado <function> a Principal() </function> . (Se você já se perguntou onde <function> a Principal() </function> é chamado, agora você sabe!).
To step through the program a line at a time, press <command>n</command>. When at a function call, step into it by pressing <command>s</command>. Once in a function call, return from it by pressing <command>f</command>, or use <command>up</command> and <command>down</command> to take a quick look at the caller.
Agora você pode percorrer o programa, uma linha de cada vez, pressionando <command> n </command> . Se você chegar a uma chamada de função, poderá entrar nela pressionando <command> s </command> . Quando estiver em uma chamada de função, você pode retornar de uma chamada de função pressionando <command> f </command> . Você também pode usar <command> acima </command> e <command> baixa </command> para dar uma olhada rápida no chamador
Here is a simple example of how to spot a mistake in a program with <command>gdb</command>. This is our program (with a deliberate mistake):
Aqui está um exemplo simples de como identificar um erro em um programa com <command> gdb </command> . Este é o nosso programa (com um erro deliberado):
<prompt>%</prompt> <userinput>cc -g -o temp temp.c</userinput>
<prompt>%</prompt> <userinput>./temp</userinput>
This is my program
anint = 4231
<prompt>%</prompt> <userinput>cc -g -o temp temp.c</userinput>
<prompt>%</prompt> <userinput>./temp</userinput>
This is my program
anint = 4231
That was not what we expected! Time to see what is going on!
Isso não foi o que esperávamos! Hora de ver o que está acontecendo!
<prompt>%</prompt> <userinput>gdb temp</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>break main</userinput> <lineannotation>Skip the set-up code</lineannotation>
Breakpoint 1 at 0x160f: file temp.c, line 9. <lineannotation>gdb puts breakpoint at main()</lineannotation>
(gdb) <userinput>run</userinput> <lineannotation>Run as far as main()</lineannotation>
Starting program: /home/james/tmp/temp <lineannotation>Program starts running</lineannotation>

Breakpoint 1, main () at temp.c:9 <lineannotation>gdb stops at main()</lineannotation>
(gdb) <userinput>n</userinput> <lineannotation>Go to next line</lineannotation>
This is my program <lineannotation>Program prints out</lineannotation>
(gdb) <userinput>s</userinput> <lineannotation>step into bazz()</lineannotation>
bazz (anint=4231) at temp.c:17 <lineannotation>gdb displays stack frame</lineannotation>
(gdb)
<prompt>%</prompt> <userinput>gdb temp</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>break main</userinput> <lineannotation>Skip the set-up code</lineannotation>
Breakpoint 1 at 0x160f: file temp.c, line 9. <lineannotation>gdb puts breakpoint at main()</lineannotation>
(gdb) <userinput>run</userinput> <lineannotation>Run as far as main()</lineannotation>
Starting program: /home/james/tmp/temp <lineannotation>Program starts running</lineannotation>

Breakpoint 1, main () at temp.c:9 <lineannotation>gdb stops at main()</lineannotation>
(gdb) <userinput>n</userinput> <lineannotation>Go to next line</lineannotation>
This is my program <lineannotation>Program prints out</lineannotation>
(gdb) <userinput>s</userinput> <lineannotation>step into bazz()</lineannotation>
bazz (anint=4231) at temp.c:17 <lineannotation>gdb displays stack frame</lineannotation>
(gdb)
Hang on a minute! How did <symbol>anint</symbol> get to be <literal>4231</literal>? Was it not set to <literal>5</literal> in <function>main()</function>? Let us move up to <function>main()</function> and have a look.
Espere um minuto! Como foi <symbol> não anint </symbol> chegar a ser <literal> 4231 </literal> ? Nós não definimos para sermos <literal> 5 </literal> dentro <function> a Principal() </function> ? Vamos subir para <function> a Principal() </function> e dê uma olhada.
(gdb) <userinput>up</userinput> <lineannotation>Move up call stack</lineannotation>
#1 0x1625 in main () at temp.c:11 <lineannotation>gdb displays stack frame</lineannotation>
(gdb) <userinput>p i</userinput> <lineannotation>Show us the value of i</lineannotation>
$1 = 4231 <lineannotation>gdb displays 4231</lineannotation>
(gdb) <userinput>up</userinput> <lineannotation>Move up call stack</lineannotation>
#1 0x1625 in main () at temp.c:11 <lineannotation>gdb displays stack frame</lineannotation>
(gdb) <userinput>p i</userinput> <lineannotation>Show us the value of i</lineannotation>
$1 = 4231 <lineannotation>gdb displays 4231</lineannotation>
but we left the <literal>i=5;</literal> line out. As we did not initialize <symbol>i</symbol>, it had whatever number happened to be in that area of memory when the program ran, which in this case happened to be <literal>4231</literal>.
mas deixamos o <literal> i = 5; </literal> line out. Como nós não inicializamos <symbol> Eu </symbol> , tinha qualquer número que estivesse naquela área de memória quando o programa rodava, o que neste caso aconteceu <literal> 4231 </literal>
The <command>gdb</command> command displays the stack frame every time we go into or out of a function, even if we are using <command>up</command> and <command>down</command> to move around the call stack. This shows the name of the function and the values of its arguments, which helps us keep track of where we are and what is going on. (The stack is a storage area where the program stores information about the arguments passed to functions and where to go when it returns from a function call.)
<command> gdb </command> exibe o quadro da pilha toda vez que entramos ou saímos de uma função, mesmo se estivermos usando <command> acima </command> e <command> baixa </command> para percorrer a pilha de chamadas. Isso mostra o nome da função e os valores de seus argumentos, o que nos ajuda a saber onde estamos e o que está acontecendo. (A pilha é uma área de armazenamento onde o programa armazena informações sobre os argumentos passados ​​às funções e para onde ir quando retorna de uma chamada de função).
Examining a Core File with gdb
Examinando um arquivo principal
To examine a core file, start up <command>gdb</command> in the usual way. Instead of typing <command>break</command> or <command>run</command>, type
Para examinar um arquivo principal, inicie <command> gdb </command> da maneira usual. Em vez de digitar <command> pausa </command> ou <command> corre </command> , tipo
(gdb) <userinput>core <replaceable>progname</replaceable>.core</userinput>
(gdb) <userinput>core <replaceable>progname</replaceable>.core</userinput>
If the core file is not in the current directory, type <userinput>dir /path/to/core/file</userinput> first.
Se você não está no mesmo diretório que o arquivo principal, você terá que fazer <userinput> dir / caminho / para / core / arquivo </userinput> primeiro.
The debugger should display something like this:
Você deveria ver algo assim:
<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
(gdb)
<prompt>%</prompt> <userinput>gdb a.out</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 a.out.core</userinput>
Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
Cannot access memory at address 0x7020796d.
#0 0x164a in bazz (anint=0x5) at temp.c:17
(gdb)
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>.
Neste caso, o programa foi chamado <filename> a.out </filename> , então o arquivo principal é chamado <filename> a.out.core </filename> . Podemos ver que o programa travou devido a tentar acessar uma área na memória que não estava disponível para ele em uma função chamada <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:
Às vezes é útil poder ver como uma função foi chamada, já que o problema poderia ter ocorrido um longo caminho até a pilha de chamadas em um programa complexo. <command> bt </command> causas de comando <command> gdb </command> para imprimir um rastreamento da pilha de chamadas:
(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
(gdb)
(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
(gdb)
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>.
O <function> fim() </function> função é chamada quando um programa falha; neste caso, o <function> bazz () </function> função foi chamada de <function> a Principal() </function>
Attaching to a Running Program with gdb
Anexando a um programa em execução
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.
Uma das características mais interessantes sobre <command> gdb </command> é que ele pode se conectar a um programa que já está em execução. Claro, isso pressupõe que você tenha permissões suficientes para isso. Um problema comum é quando você está percorrendo um programa que se bifurca e deseja rastrear o filho, mas o depurador só permitirá rastrear o pai.
To do that, start up another <command>gdb</command>, use <command>ps</command> to find the process ID for the child, and do
O que você faz é iniciar outra <command> gdb </command> , usar <command> ps </command> para encontrar o ID do processo para o filho e fazer
(gdb) <userinput>attach <replaceable>pid</replaceable></userinput>
(gdb) <userinput>attach <replaceable>pid</replaceable></userinput>
in <command>gdb</command>, and then debug as usual.
dentro <command> gdb </command> e, em seguida, depurar como de costume
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!
Agora tudo que você tem a fazer é anexar à criança, definir <symbol> PauseMode </symbol> para <literal> 0 </literal> e aguarde o <function> dormir() </function> ligue para voltar!
Using Emacs as a Development Environment
Usando o Emacs como um ambiente de desenvolvimento
Emacs
Emacs
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.
O Emacs é um editor altamente personalizável - de fato, foi customizado ao ponto de se parecer mais com um sistema operacional do que com um editor! Muitos desenvolvedores e administradores de sistemas gastam praticamente todo o seu tempo trabalhando dentro do Emacs, deixando apenas para logar Fora.
It is impossible even to summarize everything Emacs can do here, but here are some of the features of interest to developers:
É impossível resumir tudo o que o Emacs pode fazer aqui, mas aqui estão algumas das características de interesse para os desenvolvedores:
Very powerful editor, allowing search-and-replace on both strings and regular expressions (patterns), jumping to start/end of block expression, etc, etc.
Editor muito poderoso, permitindo pesquisar e substituir em cadeias de caracteres e expressões regulares (padrões), saltando para o início / fim da expressão de bloco, etc, etc.

Loading…

User avatar None

Source string changed

FreeBSD Doc / books_developers-handbookPortuguese (Brazil)

<prompt>%</prompt> <userinput>gdb a.out<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 a.out.core</userinput>
Core was generated by `a.out
<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
(gdb)
a month ago
Browse all component changes

Things to check

XML markup

XML tags in translation do not match source

Reset

Glossary

English Portuguese (Brazil)
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect3/screen
Labels
No labels currently set.
Flags
no-wrap
Source string location
book.translate.xml:2212
Source string age
a month ago
Translation file
books/pt_BR/developers-handbook.po, string 391