Subversion Repositories Kolibri OS

Rev

Rev 809 | Rev 1265 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 809 Rev 998
Line 571... Line 571...
571
	push	ecx
571
	push	ecx
572
	push	esi
572
	push	esi
573
	mov	eax, esi
573
	mov	eax, esi
574
	mov	esi, ecx
574
	mov	esi, ecx
575
; color
575
; color
576
	mov	ecx, 808080h
576
	mov	ecx, 40808080h
577
	cmp	[debuggee_pid], 0
577
	cmp	[debuggee_pid], 0
578
	jz	.cd
578
	jz	.cd
579
	cmp	[bSuspended], 0
579
	cmp	[bSuspended], 0
580
	jz	.cd
580
	jz	.cd
581
	xor	ecx, ecx
581
	mov	ecx, 40000000h
-
 
582
	push	edi
582
	mov	edi, [eax]
583
	mov	edi, [eax]
583
	cmp	dword [eax+oldcontext-context], edi
584
	cmp	dword [eax+oldcontext-context], edi
-
 
585
	pop	edi
584
	jz	.cd
586
	jz	.cd
585
	mov	ecx, 0x00AA00
587
	mov	ecx, 0x4000AA00
586
.cd:
588
.cd:
587
	push	4
589
	push	4
588
	pop	eax
590
	pop	eax
589
	mcall
591
	mcall
590
	imul	esi, 60000h
592
	imul	esi, 60000h
Line 607... Line 609...
607
	or	byte [edx], 20h
609
	or	byte [edx], 20h
608
	jmp	.onoff
610
	jmp	.onoff
609
.on:
611
.on:
610
	and	byte [edx], not 20h
612
	and	byte [edx], not 20h
611
.onoff:
613
.onoff:
612
	mov	ecx, 808080h
614
	mov	ecx, 40808080h
613
	cmp	[debuggee_pid], 0
615
	cmp	[debuggee_pid], 0
614
	jz	.doit
616
	jz	.doit
615
	cmp	[bSuspended], 0
617
	cmp	[bSuspended], 0
616
	jz	.doit
618
	jz	.doit
617
	xor	ecx, ecx
619
	mov	ecx, 40000000h
618
	bt	[_eflags], edi
620
	bt	[_eflags], edi
619
	lahf
621
	lahf
620
	bt	dword [_eflags + oldcontext - context], edi
622
	bt	dword [_eflags + oldcontext - context], edi
621
	rcl	ah, 1
623
	rcl	ah, 1
622
	test	ah, 3
624
	test	ah, 3
623
	jp	.doit
625
	jp	.doit
624
	mov	ecx, 0x00AA00
626
	mov	ecx, 0x4000AA00
625
.doit:
627
.doit:
626
	mov	ah, 0
628
	mov	ah, 0
-
 
629
	mov	edi, 0xFFFFFF
627
	mcall
630
	mcall
628
	ret
631
	ret
Line 629... Line 632...
629
 
632
 
630
redraw_registers:
633
draw_registers:
631
	push	13
634
	push	13
632
	pop	eax
635
	pop	eax
633
	mov	edx, 0xFFFFFF
636
	mov	edx, 0xFFFFFF
634
	mov	ebx, data_x_pos*10000h + data_x_size
637
	mov	ebx, data_x_pos*10000h + data_x_size
635
	mov	ecx, registers_y_pos*10000h + registers_y_size
638
	mov	ecx, registers_y_pos*10000h + registers_y_size
636
	mcall
639
	mcall
-
 
640
redraw_registers:
637
draw_registers:
641
	mov	edi, 0xFFFFFF
638
	mov	esi, _eax
642
	mov	esi, _eax
639
	push	4
643
	push	4
640
	pop	ecx
644
	pop	ecx
641
	mov	edx, regs_strs
645
	mov	edx, regs_strs
Line 682... Line 686...
682
	inc	edx
686
	inc	edx
683
	cmp	dl, flags_bits and 0xFF
687
	cmp	dl, flags_bits and 0xFF
684
	jnz	@b
688
	jnz	@b
685
	ret
689
	ret
Line 686... Line 690...
686
 
690
 
687
redraw_dump:
691
draw_dump:
688
	push	13
692
	push	13
689
	pop	eax
693
	pop	eax
690
	mov	edx, 0xFFFFFF
694
	mov	edx, 0xFFFFFF
691
	mov	ebx, data_x_pos*10000h + data_x_size
695
	mov	ebx, data_x_pos*10000h + data_x_size
692
	mov	ecx, dump_y_pos*10000h + dump_y_size
696
	mov	ecx, dump_y_pos*10000h + dump_y_size
693
	mcall
697
	mcall
694
draw_dump:
698
redraw_dump:
695
; addresses
699
; addresses
696
	mov	al, 47
700
	mov	al, 47
697
	mov	ebx, 80100h
701
	mov	ebx, 80100h
698
	mov	edx, data_x_pos*10000h + dump_y_pos
702
	mov	edx, data_x_pos*10000h + dump_y_pos
-
 
703
	mov	ecx, [dumppos]
699
	mov	ecx, [dumppos]
704
	mov	edi, 0xFFFFFF
700
	mov	esi, 808080h
705
	mov	esi, 40808080h
701
	cmp	[debuggee_pid], 0
706
	cmp	[debuggee_pid], 0
702
	jz	@f
707
	jz	@f
703
	cmp	[bSuspended], 0
708
	cmp	[bSuspended], 0
704
	jz	@f
709
	jz	@f
705
	xor	esi, esi
710
	mov	esi, 40000000h
706
@@:
711
@@:
707
	mcall
712
	mcall
708
	add	ecx, 10h
713
	add	ecx, 10h
709
	add	edx, 10
714
	add	edx, 10
710
	cmp	dl, dump_y_pos + dump_y_size
715
	cmp	dl, dump_y_pos + dump_y_size
711
	jb	@b
716
	jb	@b
712
; hex dump of data
-
 
713
	mov	ebx, 20101h
717
; hex dump of data
714
	mov	ecx, dumpdata
718
	mov	ecx, dumpdata
715
	push	ecx
719
	push	ecx
716
	xor	edi, edi
720
	xor	ebx, ebx
717
	mov	edx, (data_x_pos+12*6)*10000h + dump_y_pos
721
	mov	edx, (data_x_pos+12*6)*10000h + dump_y_pos
718
	cmp	[dumpread], edi
722
	cmp	[dumpread], ebx
719
	jz	.hexdumpdone1
723
	jz	.hexdumpdone1
-
 
724
.hexdumploop1:
-
 
725
	push	ebx
720
.hexdumploop1:
726
	mov	ebx, 20101h
-
 
727
	mcall
721
	mcall
728
	pop	ebx
722
	add	edx, 3*6*10000h
729
	add	edx, 3*6*10000h
723
	inc	ecx
730
	inc	ecx
724
	inc	edi
731
	inc	ebx
725
	test	edi, 15
732
	test	bl, 15
726
	jz	.16
733
	jz	.16
727
	test	edi, 7
734
	test	bl, 7
728
	jnz	@f
735
	jnz	@f
729
	add	edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
736
	add	edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
730
.16:
737
.16:
731
	add	edx, 10 - 6*(3*10h+2)*10000h
738
	add	edx, 10 - 6*(3*10h+2)*10000h
732
@@:
739
@@:
733
	cmp	edi, [dumpread]
740
	cmp	ebx, [dumpread]
734
	jb	.hexdumploop1
741
	jb	.hexdumploop1
735
.hexdumpdone1:
742
.hexdumpdone1:
736
	mov	al, 4
743
	mov	al, 4
737
	mov	ecx, esi
744
	mov	ecx, esi
738
	mov	ebx, edx
745
	xchg	ebx, edx
739
	push	2
746
	push	2
740
	pop	esi
-
 
741
	mov	edx, aQuests
747
	pop	esi
742
.hexdumploop2:
748
.hexdumploop2:
743
	cmp	edi, dump_height*10h
749
	cmp	edx, dump_height*10h
-
 
750
	jae	.hexdumpdone2
-
 
751
	push	edx
744
	jae	.hexdumpdone2
752
	mov	edx, aQuests
-
 
753
	mcall
745
	mcall
754
	pop	edx
746
	add	ebx, 3*6*10000h
755
	add	ebx, 3*6*10000h
747
	inc	edi
756
	inc	edx
748
	test	edi, 15
757
	test	dl, 15
749
	jz	.16x
758
	jz	.16x
750
	test	edi, 7
759
	test	dl, 7
751
	jnz	.hexdumploop2
760
	jnz	.hexdumploop2
752
	add	ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
761
	add	ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h
753
.16x:
762
.16x:
754
	add	ebx, 10 - 6*(3*10h+2)*10000h
763
	add	ebx, 10 - 6*(3*10h+2)*10000h
Line 770... Line 779...
770
	add	ebx, 10
779
	add	ebx, 10
771
	cmp	bl, dump_y_pos+dump_height*10
780
	cmp	bl, dump_y_pos+dump_height*10
772
	jb	@b
781
	jb	@b
773
; ASCII data
782
; ASCII data
774
	mov	ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
783
	mov	ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos
775
	mov	edi, dump_height*10h
-
 
776
	pop	edx
784
	pop	edx
-
 
785
	push	dump_height*10h
777
.asciiloop:
786
.asciiloop:
778
	push	edx
787
	push	edx
779
	cmp	byte [edx], 20h
788
	cmp	byte [edx], 20h
780
	jae	@f
789
	jae	@f
781
	mov	edx, aPoint
790
	mov	edx, aPoint
782
@@:
791
@@:
783
	mcall
792
	mcall
784
	pop	edx
793
	pop	edx
785
	inc	edx
794
	inc	edx
786
	add	ebx, 6*10000h
795
	add	ebx, 6*10000h
787
	dec	edi
796
	dec	dword [esp]
788
	jz	.asciidone
797
	jz	.asciidone
789
	test	edi, 15
798
	test	byte [esp], 15
790
	jnz	.asciiloop
799
	jnz	.asciiloop
791
	add	ebx, 10 - 6*10h*10000h
800
	add	ebx, 10 - 6*10h*10000h
792
	jmp	.asciiloop
801
	jmp	.asciiloop
793
.asciidone:
802
.asciidone:
-
 
803
	pop	ecx
794
	ret
804
	ret
Line 795... Line 805...
795
 
805
 
796
redraw_disasm:
806
redraw_disasm:
797
	push	13
807
;	push	13
798
	pop	eax
808
;	pop	eax
799
	mov	edx, 0xFFFFFF
809
;	mov	edx, 0xFFFFFF
800
	mov	ebx, data_x_pos*10000h + data_x_size
810
;	mov	ebx, data_x_pos*10000h + data_x_size
801
	mov	ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
811
;	mov	ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1)
802
	mcall
812
;	mcall
803
draw_disasm:
813
draw_disasm:
804
	mov	eax, [disasm_start_pos]
814
	mov	eax, [disasm_start_pos]
805
	mov	[disasm_cur_pos], eax
815
	mov	[disasm_cur_pos], eax
806
	and	[disasm_cur_str], 0
816
	and	[disasm_cur_str], 0
Line 815... Line 825...
815
@@:	lodsb
825
@@:	lodsb
816
	test	al, al
826
	test	al, al
817
	jnz	@b
827
	jnz	@b
818
	mov	byte [esi-1], ':'
828
	mov	byte [esi-1], ':'
819
	sub	esi, edx
829
	sub	esi, edx
820
	xor	ecx, ecx
830
	mov	ecx, 40000000h
-
 
831
	mov	edi, 0xFFFFFF
821
	push	4
832
	push	4
822
	pop	eax
833
	pop	eax
823
	mcall
834
	mcall
824
	mov	byte [esi+edx-1], 0
835
	mov	byte [esi+edx-1], 0
-
 
836
	lea	esi, [esi*3]
-
 
837
	movzx	ecx, bx
-
 
838
	shr	ebx, 16
-
 
839
	lea	ebx, [ebx+esi*2]
-
 
840
	shl	ecx, 16
-
 
841
	mov	cl, 10
-
 
842
	imul	ebx, 10001h
-
 
843
	sub	bx, data_x_pos+data_x_size
-
 
844
	neg	bx
-
 
845
	mov	al, 13
-
 
846
	mov	edx, edi
-
 
847
	mcall
825
	inc	[disasm_cur_str]
848
	inc	[disasm_cur_str]
826
	cmp	[disasm_cur_str], disasm_height
849
	cmp	[disasm_cur_str], disasm_height
827
	jae	.loopend
850
	jae	.loopend
828
.nosymb:
851
.nosymb:
829
	push	[disasm_cur_pos]
852
	push	[disasm_cur_pos]
830
	call	disasm_instr
853
	call	disasm_instr
831
	pop	ebp
854
	pop	ebp
832
	jc	.loopend
855
	jc	.loopend
833
	xor	esi, esi	; default color: black
856
	xor	esi, esi	; default color: black
-
 
857
	mov	edx, 0xFFFFFF	; default background: white
834
	mov	ebx, data_x_pos*10000h + data_x_size
858
	mov	ebx, data_x_pos*10000h + data_x_size
835
	mov	ecx, [disasm_cur_str]
859
	mov	ecx, [disasm_cur_str]
836
	imul	ecx, 10*10000h
860
	imul	ecx, 10*10000h
837
	add	ecx, (disasm_y_pos-1)*10000h + 10
861
	add	ecx, (disasm_y_pos-1)*10000h + 10
838
	mov	eax, ebp
862
	mov	eax, ebp
839
	pushad
863
	pushad
840
	call	find_enabled_breakpoint
864
	call	find_enabled_breakpoint
841
	popad
865
	popad
842
	jnz	.nored
866
	jnz	.nored
843
	push	13
-
 
844
	pop	eax
-
 
845
	mov	edx, 0xFF0000
867
	mov	edx, 0xFF0000	; use background: red
846
	mcall
-
 
847
.nored:
868
.nored:
848
	mov	eax, [_eip]
869
	mov	eax, [_eip]
849
	cmp	eax, ebp
870
	cmp	eax, ebp
850
	jnz	.noblue
871
	jnz	.noblue
851
	push	13
-
 
852
	pop	eax
-
 
853
	mov	edx, 0x0000FF
872
	mov	edx, 0x0000FF	; use background: blue
854
	mcall
-
 
855
	mov	esi, 0xFFFFFF	; on blue bgr, use white color
873
	mov	esi, 0xFFFFFF	; on blue bgr, use white color
856
.noblue:
874
.noblue:
857
	push	47
875
	push	13
858
	pop	eax
876
	pop	eax
-
 
877
	mcall
-
 
878
	mov	al, 47
859
	mov	ebx, 80100h
879
	mov	ebx, 80100h
860
	mov	edx, [disasm_cur_str]
880
	mov	edx, [disasm_cur_str]
861
	imul	edx, 10
881
	imul	edx, 10
862
	add	edx, data_x_pos*10000h + disasm_y_pos
882
	add	edx, data_x_pos*10000h + disasm_y_pos
863
	mov	ecx, ebp
883
	mov	ecx, ebp
864
	mcall
884
	mcall
865
	mov	al, 4
885
	mov	al, 4
866
	lea	ebx, [edx+8*6*10000h]
886
	lea	ebx, [edx+8*6*10000h]
867
	mov	ecx, esi
887
	mov	ecx, esi
868
	push	1
888
	push	2
869
	pop	esi
889
	pop	esi
870
	mov	edx, aColon
890
	mov	edx, aColon
871
	mcall
891
	mcall
872
	push	9
892
	push	9
873
	pop	edi
893
	pop	edi
874
	lea	edx, [ebx+2*6*10000h]
894
	lea	edx, [ebx+2*6*10000h]
875
	mov	esi, ecx
895
	mov	esi, ecx
876
	mov	al, 47
-
 
877
	mov	ebx, 20101h
-
 
878
	mov	ecx, ebp
896
	mov	ecx, ebp
879
	sub	ecx, [disasm_start_pos]
897
	sub	ecx, [disasm_start_pos]
880
	add	ecx, disasm_buffer
898
	add	ecx, disasm_buffer
881
.drawhex:
899
.drawhex:
-
 
900
	mov	al, 47
-
 
901
	mov	ebx, 20101h
882
	mcall
902
	mcall
883
	add	edx, 6*3*10000h
903
	add	edx, 6*3*10000h
884
	inc	ecx
904
	inc	ecx
885
	inc	ebp
905
	inc	ebp
886
	cmp	ebp, [disasm_cur_pos]
906
	cmp	ebp, [disasm_cur_pos]
Line 917... Line 937...
917
	mcall
937
	mcall
918
	inc	[disasm_cur_str]
938
	inc	[disasm_cur_str]
919
	cmp	[disasm_cur_str], disasm_height
939
	cmp	[disasm_cur_str], disasm_height
920
	jb	.loop
940
	jb	.loop
921
.loopend:
941
.loopend:
-
 
942
	mov	ecx, disasm_height
-
 
943
	sub	ecx, [disasm_cur_str]
-
 
944
	jz	@f
-
 
945
	imul	ecx, 10
-
 
946
	mov	eax, disasm_y_pos + disasm_y_size
-
 
947
	sub	eax, ecx
-
 
948
	shl	eax, 16
-
 
949
	add	ecx, eax
-
 
950
	push	13
-
 
951
	pop	eax
-
 
952
	mov	ebx, data_x_pos*65536 + data_x_size
-
 
953
	mov	edx, 0xFFFFFF
-
 
954
	mcall
-
 
955
@@:
922
	ret
956
	ret
Line 923... Line 957...
923
 
957
 
924
update_disasm_eip:
958
update_disasm_eip:
925
; test if instruction at eip is showed
959
; test if instruction at eip is showed
Line 976... Line 1010...
976
	mcall
1010
	mcall
977
; define window
1011
; define window
978
	xor	eax, eax
1012
	xor	eax, eax
979
	mov	ebx, wnd_x_size
1013
	mov	ebx, wnd_x_size
980
	mov	ecx, wnd_y_size
1014
	mov	ecx, wnd_y_size
981
	mov	edx, 14FFFFFFh
1015
	mov	edx, 54FFFFFFh
982
	mov	edi, caption_str
1016
	mov	edi, caption_str
983
	mcall
1017
	mcall
-
 
1018
; clear unused areas
-
 
1019
	mov	al, 48
-
 
1020
	push	4
-
 
1021
	pop	ebx
-
 
1022
	mcall
-
 
1023
	cmp	eax, title_y_pos
-
 
1024
	jb	@f
-
 
1025
	push	registers_y_pos
-
 
1026
	pop	eax
-
 
1027
@@:
-
 
1028
	push	registers_y_pos
-
 
1029
	pop	ecx
-
 
1030
	push	eax
-
 
1031
	sub	ecx, eax
-
 
1032
	shl	eax, 16
-
 
1033
	add	ecx, eax
-
 
1034
	mov	ebx, 5*10000h + (wnd_x_size-9)
-
 
1035
	push	13
-
 
1036
	pop	eax
-
 
1037
	mcall
-
 
1038
	mov	ecx, (registers_y_pos+registers_y_size)*10000h + (dump_y_pos-registers_y_pos-registers_y_size)
-
 
1039
	mcall
-
 
1040
	mov	ecx, (dump_y_pos+dump_y_size)*10000h + (disasm_y_pos-dump_y_pos-dump_y_size)
-
 
1041
	mcall
-
 
1042
	mov	ecx, (disasm_y_pos+disasm_y_size)*10000h + (messages_y_pos-disasm_y_pos-disasm_y_size)
-
 
1043
	mcall
-
 
1044
	mov	ecx, (messages_y_pos+messages_y_size)*10000h + (wnd_y_size-messages_y_pos-messages_y_size-4)
-
 
1045
	mcall
-
 
1046
	mov	ebx, 5*10000h + (data_x_pos-5)
-
 
1047
	pop	ecx
-
 
1048
	imul	ecx, 10001h
-
 
1049
	sub	cx, wnd_y_size-4
-
 
1050
	neg	cx
-
 
1051
	mcall
-
 
1052
	mov	ebx, (data_x_pos+data_x_size)*10000h + (wnd_x_size-data_x_pos-data_x_size-4)
-
 
1053
	mcall
984
; messages frame
1054
; messages frame
985
	mov	al, 38
1055
	mov	al, 38
986
	mov	ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2)
1056
	mov	ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2)
987
	push	ebx
1057
	push	ebx
988
	mov	ecx, (messages_y_pos-2)*10001h
1058
	mov	ecx, (messages_y_pos-2)*10001h
Line 1023... Line 1093...
1023
	mov	ebx, (data_x_pos-2)*10000h + (data_x_pos+data_x_size+2)
1093
	mov	ebx, (data_x_pos-2)*10000h + (data_x_pos+data_x_size+2)
1024
	mov	ecx, (dump_y_pos-3)*10001h
1094
	mov	ecx, (dump_y_pos-3)*10001h
1025
	mcall
1095
	mcall
1026
	mov	ecx, (disasm_y_pos-4)*10001h
1096
	mov	ecx, (disasm_y_pos-4)*10001h
1027
	mcall
1097
	mcall
1028
	call	draw_title
1098
	call	redraw_title
1029
	call	draw_registers
1099
	call	draw_registers
1030
	call	draw_dump
1100
	call	draw_dump
1031
	call	draw_disasm
1101
	call	redraw_disasm
1032
; end redraw
1102
; end redraw
1033
	push	12
1103
	push	12
1034
	pop	eax
1104
	pop	eax
1035
	push	2
1105
	push	2
1036
	pop	ebx
1106
	pop	ebx
Line 5607... Line 5677...
5607
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5677
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5608
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5678
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 5609... Line 5679...
5609
 
5679
 
5610
caption_str db 'Kolibri Debugger',0
5680
caption_str db 'Kolibri Debugger',0
5611
caption_len = $ - caption_str
5681
caption_len = $ - caption_str
5612
begin_str db	'Kolibri Debugger, version 0.31',10
5682
begin_str db	'Kolibri Debugger, version 0.32',10
5613
	db	'Hint: type "help" for help, "quit" for quit'
5683
	db	'Hint: type "help" for help, "quit" for quit'
5614
newline	db	10,0
5684
newline	db	10,0
Line 5615... Line 5685...
5615
prompt	db	'> ',0
5685
prompt	db	'> ',0
Line 5876... Line 5946...
5876
aRunning	db	'Running'
5946
aRunning	db	'Running'
5877
aPaused		db	'Paused'
5947
aPaused		db	'Paused'
5878
aPoint		db	0x1C
5948
aPoint		db	0x1C
5879
aMinus		db	'-'
5949
aMinus		db	'-'
5880
aColon		db	':'
5950
aColon		db	':'
-
 
5951
aSpace		db	' '
5881
aQuests		db	'??'
5952
aQuests		db	'??'
5882
aDots		db	'...'
5953
aDots		db	'...'
5883
aParseError	db	'Parse error',10,0
5954
aParseError	db	'Parse error',10,0
5884
aDivByZero	db	'Division by 0',10,0
5955
aDivByZero	db	'Division by 0',10,0
5885
calc_string	db	'%8X',10,0
5956
calc_string	db	'%8X',10,0