here is the code that i used with command line GDB and DDD GUI interface for GDB
I tried setting the break points and used the right assembler options and linking options .
Thou the programm dosnt stop at the BP i advice it to stop at
[code]
%include "io.mac"
.DATA
char_prompt db "Please input a character: ", 0
out_msg1 db "The ASCII code of '", 0
out_msg2 db "' in binary is ", 0
query_msg db "Do you want to quit (Y/N): ", 0
.CODE
.STARTUP
read_char:
PutStr char_prompt
GetCh AL
PutStr out_msg1
PutCh AL
PutStr out_msg2
PutCh AH
BP mov AH, 80H
mov CX, 8
print_bit:
BP test AL, AH
jz print_0
PutCh '1'
jmp skip1
print_0:
PutCh '0'
skip1:
shr AH, 1
loop print_bit
nwln
PutStr query_msg
GetCh AL
cmp AL, 'Y'
jne read_char
done:
.EXIT
[/code]
I use these steps to assemble and link the programm
nasm -f elf -g -F stabs
ld -o io.o
then i start debugger as such ..
GDB
then i set the breakpoints with these commands
(gdb) break which in my case is 20 and 24 .
I have writting BP in the code above to let you know where the brek points are .
Then when i execute the program with a
(gdb)r
the programm runs till its normal end . Thou the Debugger dosnt break at the where the breakpoints are set .
Please let me know what the proble is .. I tried doing everything by the book but it dosnt work .
Oh one thing is . That if i set the break point where i would be calling a function .
With Call it breaks there only
so if i do .
(gdb)rbreak
Set break points on all Functions . They break but not where i want it to .
Thanks
I tried setting the break points and used the right assembler options and linking options .
Thou the programm dosnt stop at the BP i advice it to stop at
[code]
%include "io.mac"
.DATA
char_prompt db "Please input a character: ", 0
out_msg1 db "The ASCII code of '", 0
out_msg2 db "' in binary is ", 0
query_msg db "Do you want to quit (Y/N): ", 0
.CODE
.STARTUP
read_char:
PutStr char_prompt
GetCh AL
PutStr out_msg1
PutCh AL
PutStr out_msg2
PutCh AH
BP mov AH, 80H
mov CX, 8
print_bit:
BP test AL, AH
jz print_0
PutCh '1'
jmp skip1
print_0:
PutCh '0'
skip1:
shr AH, 1
loop print_bit
nwln
PutStr query_msg
GetCh AL
cmp AL, 'Y'
jne read_char
done:
.EXIT
[/code]
I use these steps to assemble and link the programm
nasm -f elf -g -F stabs
ld -o io.o
then i start debugger as such ..
GDB
then i set the breakpoints with these commands
(gdb) break which in my case is 20 and 24 .
I have writting BP in the code above to let you know where the brek points are .
Then when i execute the program with a
(gdb)r
the programm runs till its normal end . Thou the Debugger dosnt break at the where the breakpoints are set .
Please let me know what the proble is .. I tried doing everything by the book but it dosnt work .
Oh one thing is . That if i set the break point where i would be calling a function .
With Call it breaks there only
so if i do .
(gdb)rbreak
Set break points on all Functions . They break but not where i want it to .
Thanks