1
0

MTDBG: load symbol information from .bss and .data sections in map file. Fixed bug which caused active register set title to dissapear on redraw.

git-svn-id: svn://kolibrios.org@4888 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-04-24 11:42:27 +00:00
parent b4f89a0b48
commit 9126601c02
2 changed files with 32 additions and 88 deletions
programs/develop/mtdbg

View File

@ -29,7 +29,7 @@ if COLOR_THEME eq MOVIEOS
COLOR_TXT_CHANGED = 0xec9300 COLOR_TXT_CHANGED = 0xec9300
COLOR_TXT_LABEL = 0x22b14c COLOR_TXT_LABEL = 0x22b14c
COLOR_TXT_SELECTED = 0x1d272f COLOR_TXT_SELECTED = 0x1d272f
COLOR_TXT_ADDR = 0xec9300 COLOR_TXT_HEX = 0xec9300
COLOR_TXT_BREAKPOINT = 0xec9300 COLOR_TXT_BREAKPOINT = 0xec9300
else if COLOR_THEME eq WHITE_ON_BLACK else if COLOR_THEME eq WHITE_ON_BLACK
@ -43,7 +43,7 @@ else if COLOR_THEME eq WHITE_ON_BLACK
COLOR_TXT_CHANGED = 0x00AA00 ; green COLOR_TXT_CHANGED = 0x00AA00 ; green
COLOR_TXT_LABEL = COLOR_TXT_NORMAL COLOR_TXT_LABEL = COLOR_TXT_NORMAL
COLOR_TXT_SELECTED = 0xFFFFFF ; white COLOR_TXT_SELECTED = 0xFFFFFF ; white
COLOR_TXT_ADDR = COLOR_TXT_NORMAL COLOR_TXT_HEX = COLOR_TXT_NORMAL
COLOR_TXT_BREAKPOINT = COLOR_TXT_NORMAL COLOR_TXT_BREAKPOINT = COLOR_TXT_NORMAL
else ; BLACK ON WHITE else ; BLACK ON WHITE
@ -57,7 +57,7 @@ else ; BLACK ON WHITE
COLOR_TXT_CHANGED = 0x00AA00 ; green COLOR_TXT_CHANGED = 0x00AA00 ; green
COLOR_TXT_LABEL = COLOR_TXT_NORMAL COLOR_TXT_LABEL = COLOR_TXT_NORMAL
COLOR_TXT_SELECTED = 0xFFFFFF ; white COLOR_TXT_SELECTED = 0xFFFFFF ; white
COLOR_TXT_ADDR = COLOR_TXT_NORMAL COLOR_TXT_HEX = COLOR_TXT_NORMAL
COLOR_TXT_BREAKPOINT = COLOR_TXT_NORMAL COLOR_TXT_BREAKPOINT = COLOR_TXT_NORMAL
end if end if
@ -555,8 +555,6 @@ draw_messages:
; TODO: make it cursor.draw and cursor.hide ??? ; TODO: make it cursor.draw and cursor.hide ???
draw_cursor: draw_cursor:
;push 38
;pop eax
mov ecx, cmdline_y_pos*10001h+cmdline_y_size-1 mov ecx, cmdline_y_pos*10001h+cmdline_y_size-1
mov ebx, [cmdline_pos] mov ebx, [cmdline_pos]
imul ebx, 6 imul ebx, 6
@ -564,33 +562,25 @@ draw_cursor:
mov edx, ebx mov edx, ebx
shl ebx, 16 shl ebx, 16
or ebx, edx or ebx, edx
; setting line color mov edx, COLOR_TXT_NORMAL
; was 'xor edx, edx' - black ; draw line
mov edx, COLOR_LINE
; draw line, color in edx
mcall 38 mcall 38
ret ret
hide_cursor: hide_cursor:
mov ebx, [cmdline_pos] mov ebx, [cmdline_pos]
;push 13
;pop eax
imul ebx, 6 imul ebx, 6
add ebx, cmdline_x_pos add ebx, cmdline_x_pos
shl ebx, 16 shl ebx, 16
inc ebx inc ebx
mov ecx, cmdline_y_pos*10000h + cmdline_y_size mov ecx, cmdline_y_pos*10000h + cmdline_y_size
; setting up rectangle color
; was 0xFFFFFF
mov edx, COLOR_BG_NORMAL mov edx, COLOR_BG_NORMAL
; draw container rectangle/box ; draw container rectangle/box
mcall 13 mcall 13
mov ebx, [cmdline_pos] mov ebx, [cmdline_pos]
cmp ebx, [cmdline_len] cmp ebx, [cmdline_len]
jae .ret jae .ret
;mov al, 4
; setting up text color scheme and attributes ; 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
@ -915,48 +905,30 @@ draw_flag:
; Also show current register set (common + MMX, SSE or AVX) ; Also show current register set (common + MMX, SSE or AVX)
draw_reg_title: draw_reg_title:
;push 4
;pop eax
; setting up text backround color
; was 0xFFFFFF - white
mov edi, COLOR_BG_NORMAL mov edi, COLOR_BG_NORMAL
; setting up text color
; can be usual and inactive
; normal color
; was 0x40000000 - black
mov ecx, (COLOR_TXT_NORMAL or 0x40000000) mov ecx, (COLOR_TXT_NORMAL or 0x40000000)
mov esi, 7 mov esi, 7
cmp [reg_mode], REG_MODE_CPU cmp [reg_mode], REG_MODE_CPU
jz @f jz @f
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
@@: @@:
mov edx, aMain mov edx, aMain
;mov ebx, (registers_x_pos+4)*10000h + registers_y_pos+2
; draw a text string in the window ; draw a text string in the window
mcall 4, (registers_x_pos+4)*10000h+registers_y_pos+2 mcall 4, (registers_x_pos+4)*10000h+registers_y_pos+2
cmp [reg_mode], REG_MODE_SSE cmp [reg_mode], REG_MODE_SSE
jz @f jz @f
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
@@: @@:
mov edx, aSSE mov edx, aSSE
;mov ebx, (registers_x_pos+46)*10000h + registers_y_pos+2
; draw a text string in the window ; draw a text string in the window
mcall 4, (registers_x_pos+46)*10000h+registers_y_pos+2 mcall 4, (registers_x_pos+46)*10000h+registers_y_pos+2
cmp [reg_mode], REG_MODE_AVX cmp [reg_mode], REG_MODE_AVX
jz @f jz @f
; inactive color
; was 0x40808080 - grey
mov ecx, (COLOR_TXT_INACTIVE or 0x40000000) mov ecx, (COLOR_TXT_INACTIVE or 0x40000000)
@@: @@:
mov edx, aAVX mov edx, aAVX
;mov ebx, (registers_x_pos+88)*10000h + registers_y_pos+2
; draw a text string in the window ; draw a text string in the window
mcall 4, (registers_x_pos+88)*10000h+registers_y_pos+2 mcall 4, (registers_x_pos+88)*10000h+registers_y_pos+2
ret ret
@ -965,19 +937,7 @@ draw_reg_title:
; Display common registers set + MMX + FPU ; Display common registers set + MMX + FPU
draw_main_registers: draw_main_registers:
;push 13 ; TODO: add support for FPU ST0-ST7 registers
;pop eax
;mov edx, 0xFFFFFF
;mov ebx, (registers_x_pos-1)*10000h + (registers_x_size+2)
;mov ecx, (registers_y_pos-1)*10000h + (registers_y_size+2)
; draw container rectangle/box with COLOR_BG_NORMAL
; color in edx, was 0xFFFFFF - white
mcall 13, (registers_x_pos-1)*10000h+(registers_x_size+2), (registers_y_pos-1)*10000h+(registers_y_size+2), COLOR_BG_NORMAL
; TODO: add support for FPU ST0-ST7 registers
.redraw:
; setting up background color for text and numbers output
; was 0xFFFFFF - white
mov edi, COLOR_BG_NORMAL mov edi, COLOR_BG_NORMAL
mov esi, _eax mov esi, _eax
push 4 push 4
@ -1075,20 +1035,25 @@ draw_main_registers:
; Draw SSE registers set ; Draw SSE registers set
draw_sse_registers: draw_sse_registers:
.redraw:
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Draw AVX registers set ; Draw AVX registers set
draw_avx_registers: draw_avx_registers:
.redraw:
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Draw all registers sets ; Draw all registers sets
draw_registers: draw_registers:
; draw container rectangle/box with COLOR_BG_NORMAL
mcall 13, (registers_x_pos-1)*10000h+(registers_x_size+2), (registers_y_pos-1)*10000h+(registers_y_size+2), COLOR_BG_NORMAL
call draw_reg_title call draw_reg_title
.redraw:
cmp [reg_mode], REG_MODE_CPU cmp [reg_mode], REG_MODE_CPU
jnz @f jnz @f
call draw_main_registers call draw_main_registers
@ -1104,58 +1069,27 @@ draw_registers:
call draw_avx_registers call draw_avx_registers
ret ret
.redraw:
call draw_reg_title
cmp [reg_mode], REG_MODE_CPU
jnz @f
call draw_main_registers.redraw
ret
@@:
cmp [reg_mode], REG_MODE_SSE
jnz @f
call draw_sse_registers.redraw
ret
@@:
call draw_avx_registers.redraw
ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Display memory dump ; Display memory dump
draw_dump: draw_dump:
;push 13
;pop eax
;mov edx, 0xFFFFFF
;mov ebx, data_x_pos*10000h + data_x_size
;mov ecx, dump_y_pos*10000h + dump_y_size
; draw container rectangle/box in the window ; draw container rectangle/box in the window
; with color in COLOR_BG_NORMAL (was 0xFFFFFF - white)
mcall 13, data_x_pos*10000h+data_x_size, dump_y_pos*10000h+dump_y_size, COLOR_BG_NORMAL mcall 13, data_x_pos*10000h+data_x_size, dump_y_pos*10000h+dump_y_size, COLOR_BG_NORMAL
.redraw: .redraw:
; addresses ; addresses
;mov al, 47
mov ebx, 80100h mov ebx, 80100h
mov edx, data_x_pos*10000h + dump_y_pos mov edx, data_x_pos*10000h + dump_y_pos
mov ecx, [dumppos] mov ecx, [dumppos]
; background color for text string
; was 0xFFFFFF - white
mov edi, COLOR_BG_NORMAL mov edi, COLOR_BG_NORMAL
; inactive color
; was 0x40808080 - grey
mov esi, (COLOR_TXT_INACTIVE or 0x40000000) mov esi, (COLOR_TXT_INACTIVE or 0x40000000)
cmp [debuggee_pid], 0 cmp [debuggee_pid], 0
jz @f jz @f
cmp [bSuspended], 0 cmp [bSuspended], 0
jz @f jz @f
; normal color
; was 0x40000000 - black
mov esi, (COLOR_TXT_NORMAL or 0x40000000) mov esi, (COLOR_TXT_NORMAL or 0x40000000)
@@: @@:
; draw a number in the window, color in esi ; draw a number in the window
mcall 47 mcall 47
add ecx, 10h add ecx, 10h
add edx, 10 add edx, 10
@ -1172,7 +1106,7 @@ draw_dump:
.hexdumploop1: .hexdumploop1:
push ebx push ebx
mov ebx, 20101h mov ebx, 20101h
; draw a number in the window, color in esi ; draw a number in the window
mcall mcall
pop ebx pop ebx
add edx, 3*6*10000h add edx, 3*6*10000h
@ -1395,7 +1329,7 @@ draw_disasm:
sub ecx, [disasm_start_pos] sub ecx, [disasm_start_pos]
add ecx, disasm_buffer add ecx, disasm_buffer
mov esi, COLOR_TXT_ADDR mov esi, COLOR_TXT_HEX
mov eax, [_eip] mov eax, [_eip]
cmp eax, ebp cmp eax, ebp
jnz @f jnz @f

View File

@ -120,7 +120,12 @@ OnLoadSymbols:
inc esi inc esi
mov [symbol_section], 0 mov [symbol_section], 0
cmp dword[esi], 'text' cmp dword[esi], 'text'
je .section_ok
cmp dword[esi], 'data'
je .section_ok
cmp dword[esi], 'bss '
jne .skipline jne .skipline
.section_ok:
inc [symbol_section] inc [symbol_section]
jmp .skipline jmp .skipline
.not_section: .not_section:
@ -221,7 +226,12 @@ OnLoadSymbols:
inc esi inc esi
mov [symbol_section], 0 mov [symbol_section], 0
cmp dword[esi], 'text' cmp dword[esi], 'text'
je .section_ok2
cmp dword[esi], 'data'
je .section_ok2
cmp dword[esi], 'bss '
jne .readline jne .readline
.section_ok2:
inc [symbol_section] inc [symbol_section]
jmp .readline jmp .readline
.not_section2: .not_section2: