Skip to content

Commit bbd5876

Browse files
author
Vladimir Kotal
committed
translate dbx slide
1 parent 8e092d4 commit bbd5876

File tree

1 file changed

+43
-44
lines changed

1 file changed

+43
-44
lines changed

intro.tex

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,52 +1517,54 @@
15171517
\begin{slide}
15181518
\sltitle{Debugger \texttt{dbx}}
15191519
\begin{itemize}
1520-
\item Volání:\\
1520+
\item Usage:\\
15211521
\texttt{dbx [ \emph{options} ] [ \emph{program} [ \emph{core} ] ]}
1522-
\item Nejbì¾nìj¹í pøíkazy:\\
1522+
\item Most common commands:\\
15231523
\renewcommand{\arraystretch}{0.9}
15241524
\begin{tabular}{ll}
1525-
\texttt{run [\emph{arglist}]} & start programu\\
1526-
\texttt{where} & vypi¹ zásobník\\
1527-
\texttt{print \emph{expr}} & vypi¹ výraz\\
1528-
\texttt{set \emph{var} = \emph{expr}} & zmìò hodnotu promìnné\\
1529-
\texttt{cont} & pokraèování bìhu programu\\
1530-
\texttt{next}, \texttt{step} & proveï øádku (bez/s vnoøením do funkce)\\
1531-
\texttt{stop \emph{condition}} & nastavení breakpointu\\
1532-
\texttt{trace \emph{condition}} & nastavení tracepointu\\
1533-
\texttt{command \emph{n}} & akce na breakpointu (pøíkazy následují)\\
1534-
\texttt{help [\emph{name}]} & nápovìda\\
1535-
\texttt{quit} & ukonèení debuggeru
1525+
\texttt{run [\emph{arglist}]} & program start\\
1526+
\texttt{where} & print stack\\
1527+
\texttt{print \emph{expr}} & print expression\\
1528+
\texttt{set \emph{var} = \emph{expr}} & change value of variable\\
1529+
\texttt{cont} & continue program run\\
1530+
\texttt{next}, \texttt{step} & execute a line (with/out going into func)\\
1531+
\texttt{stop \emph{condition}} & set breakpoint\\
1532+
\texttt{trace \emph{condition}} & remove tracepoint\\
1533+
\texttt{command \emph{n}} & action on breakpoint (commands follow)\\
1534+
\texttt{help [\emph{name}]} & help\\
1535+
\texttt{quit} & debugger exit
15361536
\end{tabular}
15371537
\end{itemize}
15381538
\end{slide}
15391539

15401540
\begin{itemize}
1541-
\item základní øádkový symbolický debugger, aby bylo mo¾né ho plnì vyu¾ít, musí
1542-
být program pøelo¾en s ladicími informacemi (\texttt{cc -g}). Ladìný program se
1543-
startuje z debuggeru pøíkazem \texttt{run}, nebo se debugger pøipojí k ji¾
1544-
bì¾ícímu procesu. Pomocí \texttt{dbx} lze analyzovat i havarovaný program, který
1545-
vygeneroval soubor \texttt{core}.
1546-
\item je mo¾né ho najít napø. na Solarisu, av¹ak na Linuxu a FreeBSD defaultnì
1547-
není.
1548-
\item pro debugging se zdrojovými kódy nestaèí pou¾ít volbu \texttt{-g}, je
1549-
zároveò nutné mít i zdrojáky a objektové moduly tam, kde byly pøi pøekladu. To
1550-
je typicky bì¾ná situace, proto¾e ladíte na stroji, kde zároveò i vyvíjíte.
1551-
Pokud tomu tak není, je nutné si zdrojáky a objektové moduly zajistit, pokud k
1552-
nim vede jiná cesta, lze pou¾ít dbx pøíkaz \texttt{pathmap}.
1553-
\item \texttt{gdb}-kompatibilní mód se spustí pøes \texttt{gdb on}. Pokud vás
1554-
zajímá, jaký má \texttt{dbx} ekvivalentní pøíkaz ke konkrétnímu \texttt{gdb}
1555-
pøíkazu, pomù¾e vám \texttt{help FAQ}; hned první otázka je ``A.1 Gdb does
1556-
$<$something$>$; how do I do it in dbx?''
1557-
\item pokud nepou¾ijete pøepínaè -g, bude vám dbx na Solarisu stále
1558-
platný, proto¾e zobrazí argumenty funkcí. U BSD systémù a linuxových distribucí
1559-
-g pou¾ít musíte, jinak vám debuggery moc nepomohou. Kdy je to na Solarisu
1560-
platné i bez -g je v vidìt v pøíkladu \example{debug/dbx.c}. Pøi kompilaci
1561-
s gcc a pou¾ití gdb neuká¾e pøíkaz \texttt{where} parametry funkce
1562-
\texttt{crash()} zatímco se Solaris Studio kompilerem a debuggerem dbx se
1563-
parametry funkce vypí¹í, tak¾e je vidìt hodnota která se pøiøazovala.
1564-
\item pøíklad: \example{debug/coredump.c}. Po pøelo¾ení a spu¹tìní program
1565-
spadne a zanechá core dump.
1541+
\item Basic line oriented debugger with symbols; to fully use it the program to
1542+
be debugged has to be compiled with debuggin data (\texttt{cc -g}). The program
1543+
is then started from debugger using the \texttt{run} command, or the debugger
1544+
can be connected to already running process. \texttt{dbx} can also be used to
1545+
analyze program crashes, provided a \texttt{core} file was generated.
1546+
\item It is possible to find it e.g. on Solarisu, it is not present by default
1547+
on other systems.
1548+
\item For source line debugging it is not necessary to use just the \texttt{-g}
1549+
option for translation, it is also necessary to have the object files and source
1550+
files available in the same location as they were used for compilation.
1551+
This is typically true when debugging on the system where writing code.
1552+
For other uses cases it is necessary to provide the needed files, the dbx
1553+
command \texttt{pathmap} can help with that.
1554+
\item \texttt{gdb}-compatible mode can be enabled using \texttt{gdb on}.
1555+
If you want to know what is the \texttt{dbx} equivalent command to concrete
1556+
\texttt{gdb} command, see the \texttt{help FAQ}; the very first question is
1557+
``A.1 Gdb does $<$something$>$; how do I do it in dbx?''
1558+
\item If the option \texttt{-g} is not used, dbx will be still usable on
1559+
Solarisu, because it will print function arguments. On BSD systems and Linux
1560+
distributions the \texttt{-g} has to be used, otherwise the debuggers will not
1561+
be of much use. This is demonstrated in the \example{debug/dbx.c} example.
1562+
When compiling with gcc and using gdb the \texttt{where} command will not show
1563+
the function parameters, while on Solaris with the Studio compiler and dbx
1564+
debugger the function parameters will be shown.
1565+
\item Example: \example{debug/coredump.c}. After compilation and running the
1566+
program will crash and core dump will be generated (if permitted on the system;
1567+
also see \texttt{ulimit -c})
15661568

15671569
\begin{verbatim}
15681570
$ cc coredump.c
@@ -1580,11 +1582,9 @@
15801582
[2] main(0x1, 0x8047a50, 0x8047a58, 0x8047a0c), at 0x8050a1b
15811583
\end{verbatim}
15821584

1583-
Vidíme, ve které funkci to spadlo a je mo¾né se vypsat zásobník. Nevidíme ale
1584-
pøesnì øádku kódu, kde nastal problém. Pro to je nutné pøelo¾it program s
1585-
ladícími symboly, tj. ``\texttt{cc -g coredump.c}''. Zájemce o více informací o
1586-
debugging pod unixem odkazuji na navazující pøedná¹ku ``Programování v UNIXu
1587-
II.'' (NSWI138).
1585+
Based on the above it is possible to say in which function the program crashed.
1586+
What we cannot see is the exact line in the code. For that the program has to be
1587+
compiled with debugging symbols, i.e. ``\texttt{cc -g coredump.c}''.
15881588

15891589
\begin{verbatim}
15901590
$ cc -g coredump.c
@@ -1601,7 +1601,6 @@
16011601

16021602
\end{itemize}
16031603

1604-
16051604
%%%%%
16061605

16071606
\begin{slide}

0 commit comments

Comments
 (0)