0% ont trouvé ce document utile (0 vote)
22 vues16 pages

Guide de débogage informatique

Ce document décrit les commandes de base du débogueur DEBUG. Il explique brièvement ce que font les commandes D, A, U, T, G, E, F, R, L et Help.

Transféré par

ma.chaouch
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
22 vues16 pages

Guide de débogage informatique

Ce document décrit les commandes de base du débogueur DEBUG. Il explique brièvement ce que font les commandes D, A, U, T, G, E, F, R, L et Help.

Transféré par

ma.chaouch
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd

Debug

Lancer debug
• C:\>DEBUG
-

• C:\>DEBUG [Link]
-D
150F:0100 43 65 20 70 65 74
69 74-20 74 65 78 74 65 20 73
Ce petit
Debug sans argumants
• CS=DS=ES=SS=Segment Location
• cs:0100 , Stack Pointer (SP) =ss:FFEE
• AX, BX, CX, DX, BP, SI et DI initialisé à
0.
Debug avec argumant
• Des segments differents pour des fichiers
don’t la taille depasse 64 KB.

• ss:FFFE
Adresse (Emplacement mémoire)
• Une Adresse : [n° seg]:déplacement
[…]: Facultatif
n° seg: - Un registre segment ou un
nombre hexa.
déplacement : nombre hexa.
NB: si n°seg n’est pas spécifié, il est pris
par défaut (CS, DS) en fonction de l’action
Plage (Zone mémoire)
• Une Plage : Adresse1 adresse2
– Adresse1: [n°seg]:déplacement
– Adresse2 : déplacement
• Oubien Adresse l nbre_octets
– Adresse: [n°seg]:déplacement
– Nbre_octets: la taille de la zone mémoire
Dump
• D offset
• D ES:offset
• D:La commande D employée seule affiche les
128 suivants
• D base:offset Base et Offset sont deux
nombres de 16 bits écrits en hexadécimal.
• D début fin Affichage d'une zone mémoire
délimitée entre deux adresses
• D début L long
A
• -A CS:100

• MOV [01CAH], AX
• MOV BX, AX
• MOV AX,005CH
• MOV [005CH],01C4H
• MOV BX ,[1CAH]
• MOV BX, [005CH]
• MOV [BX+5],0FFFH
U
• Commande de "désassemblage".
• Affiche le contenu de la mémoire en utilisant les
mnémoniques du langage assembleur pour afficher
les instructions.
• Exemples :
-U 100 106 Demande l'affichage des
instructions comprises entre les
adresses CS:0100 et CS:0106
• Syntaxe : U [plage]
• Commande associée : A
t
• Exécution des instructions pas à pas en affichant
après chacune d'elles l'état des registres et le
code de l'instruction suivante.
• T Exécute et trace l'instruction qui
se trouve à l'adresse CS:IP
• La commande T accepte deux paramètres :
- l'adresse de départ à faire précéder du signe
égale ( ex. T =100)
- le nombre d'instruction à tracer ( ex. T 3)
• Ces paramètre peuvent s'utiliser simultanément (
ex. T =100 3 )
• Commandes similaires : G et P

G
• La commande accepte deux paramètres
mais ils sont facultatifs : l'adresse de
départ que l'on fait précéder du signe égale
et une éventuelle adresse de point d'arrêt.
• - G Le programme démarre depuis
l'adresse CS :IP
• - G =100 Lance le programme à partir
de l'adresse CS:0100
• - G =100 108 Lance le programme
depuis l'adresse CS:0100 en plaçant un
point d'arrêt à l'adresse CS:0108
E
• Introduire de nouvelles valeurs en mémoire.
• Paramètres: adresse du début de la zone
mémoire à examiner puis les valeurs à y inscrire.
• -E CS:100 41,42,43,44,45,46,47
• -E CS:100 "ABCDEFGH«
• -D CS:100
150F:0100 41 42 43 44 45 46 47 48-20
74 65 78 74 65 20 73 ABCDEFGH
texte s
F
• F " fill " Rempli une zone mémoire avec le
ou les codes spécifiés.
• F plage liste

• - F B800:1E0 L A0 6E
R
• R " Register " Commande de visualisation
des registres
• -R
AX=0000 BX=0000 CX=0021 DX=0000
SP=FFEE BP=0000 SI=0000 DI=0000
DS=150F ES=150F SS=150F CS=150F
IP=0100 NV UP EI PL NZ NA PO NC
150F:0100 41 INC CX
• -R CX demander l'affichage du registre CXCX
0021 CX contient la valeur hexadécimale
0021:ABCD les ':' sont une invite à la
modification-
L
• La commande L permet la Chargement en
mémoire du fichier des secteurs d'un
disque sans tenir compte du système de
fichier.
• Syntaxe
: L adresse N°disque N°SecteurDeDépart
NombreDeSecteurs
• Exemple : L 100 2 0 1
= Charger à l'adresse 100, le secteur n° 0
du disque n° 2 (A=0, ... C= 2)
• W "write" Ecriture sur le disque.
Help (aide)
• Afficher toute les commande de
Debug est : ?

Common questions

Alimenté par l’IA

The 'R' command is crucial for displaying and modifying the CPU registers during a debugging session. It lists the current values of all registers, including AX, BX, CX, DX, SP, BP, SI, DI, DS, ES, SS, CS, and IP, along with status flags. By allowing the inspection and alteration of these values, it provides insights into the execution context and helps in measuring changes over time or due to specific instructions. This can diagnose logical errors in code, helping correlate register values with expected outcomes . It enhances debugging by delivering immediate visibility into the program's state at a low level .

The 'F' command fills a memory zone with specified byte values, which is beneficial for initializing memory regions or preparing certain memory conditions before executing specific tests. It can uniformly set memory for consistent test results or to simulate specific conditions such as errors or buffer overflows. Care should be taken not to overwrite critical data structures or instruction areas unintentionally, as this could lead to unpredictable program behavior or crashes . Proper memory range selection and value inputs are crucial to achieving intended simulation or initialization effects without adverse impacts .

The 'E' command is used to edit memory contents during a debugging process. It allows the introduction of new values into a specified memory address range. This can be useful for testing how changes in variable or program states affect program execution or for repairing corrupted data by manually inputting correct values . It operates by specifying memory locations and values, offering a way to simulate or alter program conditions directly in memory .

The 'D' command is used to dump the contents of memory, displaying data in hexadecimal format along with corresponding ASCII characters. It allows setting a memory range or offset and is useful for examining raw data . The 'U' command, on the other hand, disassembles memory content into assembly language instructions, showing mnemonics of the instructions in a specific memory range. This is crucial for understanding the specific operations being performed by a set of instructions in machine language . While 'D' provides a low-level data view, 'U' offers an assembly language interpretation, making it easier to understand the logic of executed code .

The address structure [n° seg]:déplacement in memory addressing is foundational for segment-based memory models, typical of x86 systems. The segment specifies the base address of a memory block, while the displacement is an offset indicating a specific byte within this segment. In debugging, this provides a way to accurately locate and manipulate memory locations. This format is crucial for addressing segments larger than 64KB, as it distinguishes between code, data, and stack segments explicitly . Understanding this structure is essential for accurate memory navigation, architectural comprehensions, and low-level program diagnostics .

The 'L' command is used for loading data directly into memory from disk sectors, irrespective of the file system format. Its syntax involves specifying a memory address, disk number, starting sector, and number of sectors to load. This command is practical for tasks that require bypassing normal file access methods, such as recovering data from boot sectors or analyzing sector-level disk data for forensic purposes . It allows granular, low-level data manipulation which is critical in debugging environments or when working directly with disk images .

Segment registers being initialized to zero establishes a predictable starting state for the program's execution environment in a debug session. This impacts debugging by providing a known baseline configuration, ensuring that any program-specific behavior is not affected by residual values from previous processes. It simplifies debugging by removing uncertainties about initial conditions, focusing attention on program-specific logic errors or issues. By starting from a clean slate, debuggers can better isolate and diagnose problems without accounting for unexpected initial states .

The 'G' command controls the execution of the debugged program. It can start executing from a specified address (using '=address'), potentially with a breakpoint set at a further location (e.g., '=100 108'). It is used when one wants to run the program from a certain point to either another break point or till the end of the program. This is useful for scenarios where the focus is on observing program behavior beyond a certain context or to quickly advance through less relevant sections . Its utility lies in providing flexibility to control program flow, minimizing manual or less critical step-by-step execution .

The 'T' command allows step-by-step execution of instructions in a debugging session. It executes and traces the instruction at the current instruction pointer (CS:IP), and after each execution, it displays the state of registers and the next instruction to execute. It supports two parameters: an optional starting address (prefixed with '=') and the number of instructions to trace, which can be used simultaneously for more precise execution control .

The 'W' command writes data from memory to disk, enabling persistent storage of session changes or the creation of test environments directly on disk. While it serves purposes like saving state or writing configuration changes, it poses risks of data corruption if not used carefully, especially if pointed to critical system sectors or files. Debuggers must ensure data integrity by double-checking write targets and ensuring no accidental overwrites occur . It necessitates an understanding of disk structures and the importance of maintaining backups before performing such operations .

Vous aimerez peut-être aussi