MTDBG: cleaned up, removed old code in gui.inc

git-svn-id: svn://kolibrios.org@4890 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-04-24 12:23:56 +00:00
parent 82f569ed2c
commit b130452317
3 changed files with 55 additions and 158 deletions

View File

@ -124,9 +124,6 @@ start:
mov esi, begin_str mov esi, begin_str
call put_message_nodraw call put_message_nodraw
; set event mask - default events and debugging events ; set event mask - default events and debugging events
;push 40
;pop eax
;mov ebx, 0x107
mcall 40, 0x107 mcall 40, 0x107
; set debug messages buffer ; set debug messages buffer
mov ecx, dbgbufsize mov ecx, dbgbufsize
@ -149,8 +146,6 @@ dodraw:
call draw_window call draw_window
waitevent: waitevent:
;push 10
;pop eax
mcall 10 mcall 10
cmp al, 9 cmp al, 9
jz debugmsg jz debugmsg
@ -161,8 +156,6 @@ waitevent:
dec eax dec eax
jnz waitevent jnz waitevent
; button pressed - we have only one button (close) ; button pressed - we have only one button (close)
;push -1
;pop eax
mcall -1 mcall -1
; TODO: split in more independent function ; TODO: split in more independent function
@ -382,8 +375,6 @@ clear_cmdline_end:
mov ebx, [cmdline_pos] mov ebx, [cmdline_pos]
mov ecx, [cmdline_len] mov ecx, [cmdline_len]
sub ecx, ebx sub ecx, ebx
;push 13
;pop eax
imul ebx, 6 imul ebx, 6
imul ecx, 6 imul ecx, 6
inc ecx inc ecx
@ -391,8 +382,6 @@ clear_cmdline_end:
shl ebx, 16 shl ebx, 16
or ebx, ecx or ebx, ecx
mov ecx, cmdline_y_pos*10000h + cmdline_y_size mov ecx, cmdline_y_pos*10000h + cmdline_y_size
; setting up container color scheme
; COLOR_BG_NORMAL was 0xFFFFFF
mov edx, COLOR_BG_NORMAL mov edx, COLOR_BG_NORMAL
; draw container rectangle/box for cmdline ; draw container rectangle/box for cmdline
mcall 13 mcall 13
@ -409,17 +398,14 @@ draw_cmdline_end:
@@: @@:
mov esi, [cmdline_len] mov esi, [cmdline_len]
sub esi, ebx sub esi, ebx
;push 4
;pop eax
; setting up text color scheme and attributes
; was 'xor ecx, ecx'
mov ecx, COLOR_TXT_NORMAL mov ecx, COLOR_TXT_NORMAL
lea edx, [cmdline+ebx] lea edx, [cmdline+ebx]
imul ebx, 6 imul ebx, 6
add ebx, cmdline_x_pos add ebx, cmdline_x_pos
shl ebx, 16 shl ebx, 16
or ebx, cmdline_y_pos+1 or ebx, cmdline_y_pos+1
; draw a text string in the window, color in ecx ; draw a text string in the window
mcall 4 mcall 4
ret ret
@ -524,21 +510,12 @@ put_message:
call put_message_nodraw call put_message_nodraw
draw_messages: draw_messages:
;push 13 ; draw container rectangle/box
;pop eax
;mov edx, 0xFFFFFF
;mov ebx, messages_x_pos*10000h+messages_x_size
;mov ecx, messages_y_pos*10000h+messages_y_size
; draw container rectanle/box
; COLOR_BG_NORMAL was 0xFFFFFF
mcall 13, messages_x_pos*10000h+messages_x_size, messages_y_pos*10000h+messages_y_size, COLOR_BG_NORMAL mcall 13, messages_x_pos*10000h+messages_x_size, messages_y_pos*10000h+messages_y_size, COLOR_BG_NORMAL
mov edx, messages mov edx, messages
push messages_width push messages_width
pop esi pop esi
; setting up text color scheme/attributes
; was 'xor ecx, ecx'
mov ecx, COLOR_TXT_NORMAL mov ecx, COLOR_TXT_NORMAL
;mov al, 4
mov ebx, messages_x_pos*10000h+messages_y_pos mov ebx, messages_x_pos*10000h+messages_y_pos
@@: @@:
@ -600,20 +577,10 @@ hide_cursor:
; FIXME: something wrong here ; FIXME: something wrong here
redraw_title: redraw_title:
;push 13
;pop eax
;mov edx, 0xFFFFFF
;mov ebx, title_x_pos*10000h + data_x_pos+data_x_size-title_x_pos
;mov ecx, title_y_pos*10000h + title_y_size
; draw container rectangle/box ; draw container rectangle/box
; color was 0xFFFFFF
mcall 13, title_x_pos*10000h+data_x_pos+data_x_size-title_x_pos, title_y_pos*10000h+title_y_size, COLOR_BG_NORMAL mcall 13, title_x_pos*10000h+data_x_pos+data_x_size-title_x_pos, title_y_pos*10000h+title_y_size, COLOR_BG_NORMAL
draw_title: draw_title:
;mov al, 38
;mov ebx, (data_x_pos-2)*10000h + title_x_pos-5
;mov ecx, (title_y_pos+5)*10001h
; draw line with COLOR_LINE (in edx)
mcall 38, (data_x_pos-2)*10000h+title_x_pos-5, (title_y_pos+5)*10001h, COLOR_LINE mcall 38, (data_x_pos-2)*10000h+title_x_pos-5, (title_y_pos+5)*10001h, COLOR_LINE
push NoPrgLoaded_len push NoPrgLoaded_len
pop esi pop esi
@ -689,40 +656,30 @@ draw_register:
push esi push esi
mov eax, esi mov eax, esi
mov esi, ecx mov esi, ecx
; setting up registers colors
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .cd jz .cd
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .cd jz .cd
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000) mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
push edi push edi
mov edi, [eax] mov edi, [eax]
cmp dword [eax+oldcontext-context], edi cmp dword [eax+oldcontext-context], edi
pop edi pop edi
jz .cd jz .cd
; changed register color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000) mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd: .cd:
;push 4
;pop eax
; draw a text string in the window ; draw a text string in the window
mcall 4 mcall 4
imul esi, 60000h imul esi, 60000h
lea edx, [ebx+esi] lea edx, [ebx+esi]
;mov al, 47
;mov ebx, 80101h
mov esi, ecx mov esi, ecx
pop ecx pop ecx
; draw a number in the window ; draw a number in the window
; color in the esi (same value as for usual text)
mcall 47, 80101h mcall 47, 80101h
lea ebx, [edx+60000h*18] lea ebx, [edx+60000h*18]
mov esi, ecx mov esi, ecx
@ -741,17 +698,13 @@ draw_fpu_register:
push esi push esi
mov eax, esi mov eax, esi
mov esi, ecx mov esi, ecx
; setting up registers color
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .cd jz .cd
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .cd jz .cd
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000) mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
push edi push edi
mov edi, [eax] mov edi, [eax]
@ -765,19 +718,13 @@ draw_fpu_register:
jz .cd jz .cd
.scol: .scol:
; changed register color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000) mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd: .cd:
;push 4
;pop eax
; draw a text string in the window ; draw a text string in the window
mcall 4 mcall 4
imul esi, 60000h imul esi, 60000h
lea edx, [ebx+esi] lea edx, [ebx+esi]
;mov al, 47
;mov ebx, 40100101h ; [20] show 16 chars set [30] bit - qword
mov esi, ecx mov esi, ecx
pop ecx pop ecx
; draw a number in the window ; draw a number in the window
@ -801,17 +748,13 @@ draw_mmx_register:
push esi push esi
mov eax, esi mov eax, esi
mov esi, ecx mov esi, ecx
; setting up registers color
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .cd jz .cd
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .cd jz .cd
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000) mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
push edi push edi
mov edi, [eax] mov edi, [eax]
@ -825,19 +768,14 @@ draw_mmx_register:
jz .cd jz .cd
.scol: .scol:
; changed color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000) mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.cd: .cd:
;push 4
;pop eax
; draw a text string in the window ; draw a text string in the window
mcall 4 mcall 4
imul esi, 60000h imul esi, 60000h
lea edx, [ebx+esi] lea edx, [ebx+esi]
;mov al, 47
;mov ebx, 40100101h ; [20] show 16 chars set [30] bit - qword
mov esi, ecx mov esi, ecx
pop ecx pop ecx
; draw a number in the window ; draw a number in the window
@ -867,17 +805,12 @@ draw_flag:
and byte [edx], not 20h and byte [edx], not 20h
.onoff: .onoff:
; setting up registers colors
; can be usual, inactive and changed
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .doit jz .doit
cmp [bSuspended], 0 cmp [bSuspended], 0
jz .doit jz .doit
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000) mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
bt [_eflags], edi bt [_eflags], edi
lahf lahf
@ -885,14 +818,10 @@ draw_flag:
rcl ah, 1 rcl ah, 1
test ah, 3 test ah, 3
jp .doit jp .doit
; changed color
; was 0x4000AA00 - green
mov ecx, (COLOR_TXT_CHANGED or 0x40000000) mov ecx, (COLOR_TXT_CHANGED or 0x40000000)
.doit: .doit:
mov ah, 0 mov ah, 0
; background color for text string or number
; was 0xFFFFFF - white
mov edi, COLOR_BG_NORMAL mov edi, COLOR_BG_NORMAL
; draw a text string in the window in one case ; draw a text string in the window in one case
; and a number in another ; and a number in another
@ -1002,10 +931,7 @@ draw_main_registers:
mov ebx, (registers_x_pos+2)*10000h+registers_y_pos+212 mov ebx, (registers_x_pos+2)*10000h+registers_y_pos+212
add esi, _mm7-_mm6 add esi, _mm7-_mm6
call draw_mmx_register call draw_mmx_register
;mov al, 4
; setting up text color
; inactive color
; was 0x808080 - grey
mov ecx, COLOR_TXT_INACTIVE mov ecx, COLOR_TXT_INACTIVE
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz @f jz @f
@ -1200,19 +1126,8 @@ draw_dump:
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Display disassembled code ; Display disassembled code
; @@@@@ WAS:
; redraw_disasm:
; push 13
; pop eax
; mov edx, 0xFFFFFF
; mov ebx, data_x_pos*10000h + data_x_size
; mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
; mcall
;
; @@@@@ NOW:
draw_disasm: draw_disasm:
.redraw:
mov eax, [disasm_start_pos] mov eax, [disasm_start_pos]
mov [disasm_cur_pos], eax mov [disasm_cur_pos], eax
and [disasm_cur_str], 0 and [disasm_cur_str], 0
@ -1229,9 +1144,6 @@ draw_disasm:
mov cl, 11 mov cl, 11
; setting up background color for disassembled text ; setting up background color for disassembled text
mov edx, COLOR_BG_NORMAL mov edx, COLOR_BG_NORMAL
;mov ebx, data_x_pos*10000h + data_x_size
;push 13
;pop eax
; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white) ; draw container rectangle/box with color COLOR_BG_NORMAL (was 0xFFFFFF - white)
mcall 13, data_x_pos*10000h+data_x_size mcall 13, data_x_pos*10000h+data_x_size
pop ebx pop ebx
@ -1302,15 +1214,13 @@ draw_disasm:
; draw container rectangle/box for disassembled text ; draw container rectangle/box for disassembled text
; color in edx ; color in edx
mcall 13 mcall 13
;mov al, 47
;mov ebx, 80100h
mov edx, [disasm_cur_str] mov edx, [disasm_cur_str]
imul edx, 10 imul edx, 10
add edx, data_x_pos*10000h + disasm_y_pos add edx, data_x_pos*10000h + disasm_y_pos
;mov ecx, ebp
; draw a number in the window, color in esi ; draw a number in the window, color in esi
mcall 47, 80100h, ebp mcall 47, 80100h, ebp
;mov al, 4
lea ebx, [edx+8*6*10000h] lea ebx, [edx+8*6*10000h]
mov ecx, esi ; text color mov ecx, esi ; text color
push 2 push 2
@ -1347,7 +1257,7 @@ draw_disasm:
cmp esi, ebp cmp esi, ebp
pop esi pop esi
jbe .drawhex jbe .drawhex
;mov al, 4
lea ebx, [edx-6*10000h] lea ebx, [edx-6*10000h]
; copy color value from esi ; copy color value from esi
mov ecx, esi mov ecx, esi
@ -1370,7 +1280,7 @@ draw_disasm:
mov ebx, [disasm_cur_str] mov ebx, [disasm_cur_str]
imul ebx, 10 imul ebx, 10
add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos
;mov al, 4
; draw a text string in the window, color in ecx ; draw a text string in the window, color in ecx
mcall 4 mcall 4
inc [disasm_cur_str] inc [disasm_cur_str]
@ -1387,14 +1297,8 @@ draw_disasm:
sub eax, ecx sub eax, ecx
shl eax, 16 shl eax, 16
add ecx, eax add ecx, eax
;push 13 ; Draw filled rectangle
;pop eax mcall 13, data_x_pos*10000h+data_x_size, , COLOR_BG_NORMAL
;mov ebx, data_x_pos*65536 + data_x_size
; set backroung color for disassembly container
; was 0xFFFFFF - white
mov edx, COLOR_BG_NORMAL
; draw container rectangle/box with color COLOR_BG_NORMAL (in edx)
mcall 13, data_x_pos*65536+data_x_size
@@: @@:
ret ret
@ -1417,7 +1321,7 @@ update_disasm_eip:
@@: @@:
cmp [_eip], eax cmp [_eip], eax
jz draw_disasm.redraw jz draw_disasm
push ecx push ecx
call disasm_instr call disasm_instr
pop ecx pop ecx
@ -1433,14 +1337,7 @@ update_disasm_eip_force:
update_disasm: update_disasm:
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz .no jz .no
;push 69
;pop eax
;push 6
;pop ebx
;mov ecx, [debuggee_pid]
;mov edi, disasm_buffer
;mov edx, 256
;mov esi, [disasm_start_pos]
mcall 69, 6, [debuggee_pid], 256, [disasm_start_pos], disasm_buffer mcall 69, 6, [debuggee_pid], 256, [disasm_start_pos], disasm_buffer
cmp eax, -1 cmp eax, -1
jnz @f jnz @f
@ -1453,7 +1350,7 @@ update_disasm:
@@: @@:
mov [disasm_buf_size], eax mov [disasm_buf_size], eax
call restore_from_breaks call restore_from_breaks
jmp draw_disasm.redraw jmp draw_disasm
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -1563,7 +1460,7 @@ draw_window:
call redraw_title call redraw_title
call draw_registers call draw_registers
call draw_dump call draw_dump
call draw_disasm.redraw call draw_disasm
; end of window redraw ; end of window redraw
mcall 12, 2 mcall 12, 2

View File

@ -1341,7 +1341,7 @@ OnBp:
call put_message call put_message
.ret: .ret:
jmp draw_disasm.redraw jmp draw_disasm
OnBpmb: OnBpmb:
mov dh, 0011b mov dh, 0011b

View File

@ -313,7 +313,7 @@ OnLoadSymbols:
call sort call sort
mov esi, aSymbolsLoaded mov esi, aSymbolsLoaded
call put_message call put_message
jmp draw_disasm.redraw jmp draw_disasm
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; ;