giu 05 2009

Debugging con GNU GDB – Introduzione

Categoria: Programmazione Csaverio @ 10:18

GNU debugger (talvolta chiamato semplicemente GDB) è il nome di un programma libero sviluppato da GNU. È il debugger predefinito del software GNU, gira su molte piattaforme (tra cui i sistemi Unix-like e Microsoft Windows) ed è capace di analizzare numerosi linguaggi di programmazione, tra cui Ada, C, C++ e Fortran.

GDB (ovvero GNU DeBugger) è molto più di un semplice debugger: è un vero e proprio program execution path analysis tool.
Invocando il comando “gdb –help” avremo:

This is the GNU debugger.  Usage:

    gdb [options] [executable-file [core-file or process-id]]
    gdb [options] --args executable-file [inferior-arguments ...]

Options:

  --args             Arguments after executable-file are passed to inferior
  --[no]async        Enable (disable) asynchronous version of CLI
  -b BAUDRATE        Set serial port baud rate used for remote debugging.
  --batch            Exit after processing options.
  --cd=DIR           Change current directory to DIR.
  --command=FILE     Execute GDB commands from FILE.
  --core=COREFILE    Analyze the core dump COREFILE.
  --pid=PID          Attach to running process PID.
  --dbx              DBX compatibility mode.
  --directory=DIR    Search for source files in DIR.
  --epoch            Output information used by epoch emacs-GDB interface.
  --exec=EXECFILE    Use EXECFILE as the executable.
  --fullname         Output information used by emacs-GDB interface.
  --help             Print this message.
  --interpreter=INTERP
                     Select a specific interpreter / user interface
  --mapped           Use mapped symbol files if supported on this system.
  --nw               Do not use a window interface.
  --nx               Do not read .gdbinit file.
  --quiet            Do not print version number on startup.
  --readnow          Fully read symbol files on first access.
  --se=FILE          Use FILE as symbol file and executable file.
  --symbols=SYMFILE  Read symbols from SYMFILE.
  --tty=TTY          Use TTY for input/output by the program being debugged.
  --version          Print version information and then exit.
  -w                 Use a window interface.
  --write            Set writing into executable and core files.
  --xdb              XDB compatibility mode.

Continua a leggere “Debugging con GNU GDB – Introduzione”

Tags: ,


giu 01 2009

Split di stringhe in C

Categoria: Programmazione Civan @ 14:23

Salve a tutti, oggi cercherò di spiegare come creare una funzione di split per le vostre stringhe in C. Tempo fa cercai su internet qualche fonte esaustiva ma non ho trovato nulla di buono.
Premetto che i requisiti affinchè capiate il tutorial è una buona conoscenza di C e dei puntatori.(Non è mio compito scoraggiare il lettore, ma l’autore fino a dicembre non sapeva nemmeno come si faceva un allocazione dinamica, con un pò di impegno, chiunque può imparare in tempi brevi!).

Finite queste quattro chiacchiere, presenterò nel tutorial 2 files, un file conterrà tutte le funzioni, l’altro invece sarà un programmino di esempio che ne illustrerà l’uso. Cominciamo con il primo file, lo chiameremo split.h, qui ci vanno le nostre funzioni, #define vari, includes…

Continua a leggere “Split di stringhe in C”

Tags: , ,


« Pagina precedente