Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1189 heavyiron 1
symbol_dump:
2
 
3
	push	edi
4
	mov	edx,[memory_end]
5
      symb_dump:
6
	cmp	edx,[labels_list]
7
	jbe	symbols_dumped
8
	sub	edx,LABEL_STRUCTURE_SIZE
9
	cmp	dword [edx+24],0
10
	je	symb_dump	; do not dump anonymous symbols
11
	test	byte [edx+8],1
12
	jz	symb_dump	; do not dump symbols that didn't get defined
13
	mov	ax,[current_pass]
14
	cmp	ax,[edx+16]
15
	jne	symb_dump
16
	test	byte [edx+8],4 or 2
17
	jnz	symb_dump	; do not dump assembly-time variables
18
				; do not dump variables defined with '='
19
	cmp	word [edx+12], 0
20
	jnz	symb_dump	; do not dump register-based variables
21
 
22
	mov	al, '0'
23
	stosb
24
	mov	al, 'x'
25
	stosb
26
	mov	eax, [edx+4]
27
	mov	ecx, 8
28
@@:
29
	rol	eax, 4
30
	test	al, 0xF
31
	loopz	@b
32
	jz	.nohigh
33
	inc	ecx
34
@@:
35
	push	eax
36
	and	al, 0xF
37
	cmp	al, 10
38
	sbb	al, 69h
39
	das
40
	stosb
41
	pop	eax
42
	rol	eax, 4
43
	loop	@b
44
	mov	eax, [edx]
45
	mov	ecx, 8
46
	jmp	.low
47
.nohigh:
48
	mov	eax, [edx]
49
	mov	ecx, 8
50
@@:
51
	rol	eax, 4
52
	test	al, 0xF
53
	loopz	@b
54
	inc	ecx
55
.low:
56
	push	eax
57
	and	al, 0xF
58
	cmp	al, 10
59
	sbb	al, 69h
60
	das
61
	stosb
62
	pop	eax
63
	rol	eax, 4
64
	loop	.low
65
 
66
	mov	al, ' '
67
	stosb
68
 
69
	mov	esi,[edx+24]
70
	movzx	ecx,byte [esi-1]
71
	rep	movsb
72
 
73
	mov	ax,0A0Dh
74
	stosw
75
 
76
	jmp	symb_dump
77
 
78
      symbols_dumped:
79
	mov	edx,dbgfilename
80
        push    esi edi
81
	mov     esi, outfile
82
	mov     edi, edx
83
@@:
84
	lodsb
85
	stosb
86
	test	al, al
87
	jnz	@b
88
	lea	ecx, [edi-1]
89
@@:
90
	dec	edi
91
	cmp	edi, edx
92
	jb	@f
93
	cmp	byte [edi], '/'
94
	jz	@f
95
	cmp	byte [edi], '.'
96
	jnz	@b
97
	mov	ecx, edi
98
@@:
99
	mov	dword [ecx], '.dbg'
100
	mov     byte [ecx+4], 0
101
	pop	edi esi
102
	call	create
103
	mov	edx,[esp]
104
	mov	ecx,edi
105
	sub	ecx,edx
106
	call	write
107
	call	close
108
	pop	edi
109
 
110
	ret