17.12.2012 Views

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

main_function()<br />

[...]<br />

Principaux modules, partie 2<br />

CHAPITRE 9<br />

tziade@Tarek:~/Desktop$ python scripts/debugging.py<br />

> /home/tziade/Desktop/scripts/debugging.py(9)main_function()<br />

-> for i in range(2):<br />

(Pdb) w<br />

/home/tziade/Desktop/scripts/debugging.py(12)?()<br />

-> ma_fonction()<br />

> /home/tziade/Desktop/scripts/debugging.py(9)main_function()<br />

-> for i in range(2):<br />

(Pdb) n<br />

> /home/tziade/Desktop/scripts/debugging.py(10)main_function()<br />

-> sub_function(str(i))<br />

(Pdb) n<br />

0<br />

0<br />

0<br />

> /home/tziade/Desktop/scripts/debugging.py(9)main_function()<br />

-> for i in range(2):<br />

(Pdb) n<br />

> /home/tziade/Desktop/scripts/debugging.py(10)main_function()<br />

-> sub_function(str(i))<br />

(Pdb) s<br />

--Call--<br />

> /home/tziade/Desktop/scripts/debugging.py(2)sub_function()<br />

-> def sub_function(text):<br />

(Pdb) n<br />

> /home/tziade/Desktop/scripts/debugging.py(3)sub_function()<br />

-> for i in range(3):<br />

(Pdb) n<br />

> /home/tziade/Desktop/scripts/debugging.py(4)sub_function()<br />

-> print(text)<br />

(Pdb) whatis text<br />

<br />

(Pdb) c<br />

1<br />

1<br />

1<br />

Outre ces commandes, le prompt (Pdb) reste un prompt Python tout à fait fonctionnel<br />

et il est possible de l’utiliser pour appeler du code à exécuter, afficher des<br />

valeurs, ou effectuer toute autre manipulation. L’environnement d’exécution est dans<br />

ce cas celui de la fonction dans laquelle le débogueur est arrêté.<br />

291

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!