Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
clean-ide
Commits
dc8f107e
Commit
dc8f107e
authored
Jul 25, 2006
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port to 64 bit windows
parent
311b4811
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
91 deletions
+120
-91
HeapProfile/ShowHeapProfile.icl
HeapProfile/ShowHeapProfile.icl
+91
-76
HeapProfile/Windows/heap_profile_os_dependent.icl
HeapProfile/Windows/heap_profile_os_dependent.icl
+28
-14
HeapProfile/file_exists.c
HeapProfile/file_exists.c
+1
-1
No files found.
HeapProfile/ShowHeapProfile.icl
View file @
dc8f107e
This diff is collapsed.
Click to expand it.
HeapProfile/Windows/heap_profile_os_dependent.icl
View file @
dc8f107e
...
@@ -14,7 +14,7 @@ import StdEnv;
...
@@ -14,7 +14,7 @@ import StdEnv;
text_addresses
::
!{#
Int
}
// for 68k
text_addresses
::
!{#
Int
}
// for 68k
};
};
import
code
from
"file_exists.
obj
"
;
import
code
from
"file_exists."
;
PCorMac
pc
mac
:==
pc
;
PCorMac
pc
mac
:==
pc
;
...
@@ -56,7 +56,7 @@ read_application file_name application_file_name header files
...
@@ -56,7 +56,7 @@ read_application file_name application_file_name header files
|
not
ok
|
not
ok
=
abort
"invalid application file"
;
=
abort
"invalid application file"
;
#!
(
n_sections
,
optional_header_size
,
app_file
)
=
ReadCOFFHeader
app_file
;
#!
(
n_sections
,
optional_header_size
,
app_file
)
=
ReadCOFFHeader
app_file
;
#!
(
code_size
,
data_size
,
base_of_code
,
base_of_data
,
image_base
,
section_alignment
,
file_alignment
,
app_file
)
=
ReadOptionalHeader
app_file
optional_header_size
;
#!
(
code_size
,
data_size
,
base_of_code
,
image_base
,
section_alignment
,
file_alignment
,
app_file
)
=
ReadOptionalHeader
app_file
optional_header_size
;
#!
((
rva_raw_text
,
text
),(
rva_raw_data
,
data
),
rva_bss
,
app_file
)
=
ReadSections
0
n_sections
(
0
,
""
)
(
0
,
""
)
0
app_file
;
#!
((
rva_raw_text
,
text
),(
rva_raw_data
,
data
),
rva_bss
,
app_file
)
=
ReadSections
0
n_sections
(
0
,
""
)
(
0
,
""
)
0
app_file
;
#!
(
ok
,
files
)
=
fclose
app_file
files
;
#!
(
ok
,
files
)
=
fclose
app_file
files
;
|
not
ok
|
not
ok
...
@@ -74,33 +74,34 @@ read_application file_name application_file_name header files
...
@@ -74,33 +74,34 @@ read_application file_name application_file_name header files
=
(
False
,
app_file
);
=
(
False
,
app_file
);
#!
(
pe_signature
,
app_file
)
=
freads
app_file
4
;
#!
(
pe_signature
,
app_file
)
=
freads
app_file
4
;
=
(
pe_signature
==
"PE
\0\0
"
,
app_file
);
=
(
pe_signature
==
"PE
\0\0
"
,
app_file
);
ReadCOFFHeader
app_file
ReadCOFFHeader
app_file
#!
(
coff_header
,
app_file
)
=
freads
app_file
20
#!
(
coff_header
,
app_file
)
=
freads
app_file
20
#!
machine
=
coff_header
WORD
0
;
#!
machine
=
coff_header
WORD
0
;
|
machine
<>
0x14c
|
machine
<>
IF_INT_64_OR_32
0x8664
0x14c
=
abort
(
"invalid application file for i386
"
);
=
abort
(
"invalid application file for i386
: "
+++
toString
machine
);
#!
n_sections
=
coff_header
WORD
2
;
#!
n_sections
=
coff_header
WORD
2
;
#!
optional_header_size
=
coff_header
WORD
16
;
#!
optional_header_size
=
coff_header
WORD
16
;
#!
characteristics
=
coff_header
WORD
18
;
#!
characteristics
=
coff_header
WORD
18
;
|
(
characteristics
bitand
3
)
<>
3
|
(
characteristics
bitand
3
)
<>
3
=
abort
(
"not an exectuable image or relocations not stripped"
);
=
abort
(
"not an exectuable image or relocations not stripped"
);
=
(
n_sections
,
optional_header_size
,
app_file
);
=
(
n_sections
,
optional_header_size
,
app_file
);
ReadOptionalHeader
app_file
optional_header_size
ReadOptionalHeader
app_file
optional_header_size
#!
(
optional_header
,
app_file
)
=
freads
app_file
optional_header_size
;
#!
(
optional_header
,
app_file
)
=
freads
app_file
optional_header_size
;
#!
magic
=
optional_header
WORD
0
;
#!
magic
=
optional_header
WORD
0
;
|
magic
<>
0x10b
|
magic
<>
IF_INT_64_OR_32
0x20b
0x10b
=
abort
(
"incorrect magic number"
);
=
abort
(
"incorrect magic number"
);
#!
code_size
=
optional_header
LONG
4
;
#!
code_size
=
optional_header
LONG
4
;
#!
data_size
=
optional_header
LONG
8
;
#!
data_size
=
optional_header
LONG
8
;
#!
base_of_code
=
optional_header
LONG
20
;
#!
base_of_code
=
optional_header
LONG
20
;
#!
base_of_data
=
optional_header
LONG
24
;
#!
image_base
=
IF_INT_64_OR_32
#!
image_base
=
optional_header
LONG
28
;
(((
optional_header
LONG
24
)
bitand
0xffffffff
)
+
(
optional_header
LONG
28
<<
32
))
(
optional_header
LONG
28
);
#!
section_alignment
=
optional_header
LONG
32
;
#!
section_alignment
=
optional_header
LONG
32
;
#!
file_alignment
=
optional_header
LONG
36
;
#!
file_alignment
=
optional_header
LONG
36
;
=
(
code_size
,
data_size
,
base_of_code
,
base_of_data
,
image_base
,
section_alignment
,
file_alignment
,
app_file
);
=
(
code_size
,
data_size
,
base_of_code
,
image_base
,
section_alignment
,
file_alignment
,
app_file
);
ReadSections
section_n
n_sections
text
=:(
rva_raw_text
,
raw_text
)
data
=:(
rva_raw_data
,
raw_data
)
rva_bss
app_file
ReadSections
section_n
n_sections
text
=:(
rva_raw_text
,
raw_text
)
data
=:(
rva_raw_data
,
raw_data
)
rva_bss
app_file
|
(
section_n
==
n_sections
)
|
(
section_n
==
n_sections
)
|
size
raw_text
==
0
||
size
raw_data
==
0
|
size
raw_text
==
0
||
size
raw_data
==
0
...
@@ -171,10 +172,15 @@ get_string_from_offset name_offset data
...
@@ -171,10 +172,15 @@ get_string_from_offset name_offset data
constructor_name
::
!
Int
!
Int
!
Int
!{#
Char
}
{#
Char
}
->
(!{#
Char
},!{#
Char
});
constructor_name
::
!
Int
!
Int
!
Int
!{#
Char
}
{#
Char
}
->
(!{#
Char
},!{#
Char
});
constructor_name
data_begin
data_offset
arity
data
text
constructor_name
data_begin
data_offset
arity
data
text
#
descriptor_max_arity_offset
=
data_offset
+
(
data
WORD
(
data_offset
+2
));
#!
string_offset
=
descriptor_max_arity_offset
+12
;
#
module_name_pointer
=
data
LONG
(
descriptor_max_arity_offset
+
8
);
/*
# nameP = data_offset - (data WORD (data_offset+2));
# nameP = data_offset - (data WORD (data_offset+2));
# total_descriptor_arity = data WORD (nameP - 2);
# total_descriptor_arity = data WORD (nameP - 2);
#! string_offset = nameP+4 + (total_descriptor_arity << 3);
#! string_offset = nameP+4 + (total_descriptor_arity << 3);
# module_name_pointer = data LONG (nameP - 12);
# module_name_pointer = data LONG (nameP - 12);
*/
=
(
get_string_from_offset
string_offset
data
,
get_string_from_pointer
module_name_pointer
data_begin
data
);
=
(
get_string_from_offset
string_offset
data
,
get_string_from_pointer
module_name_pointer
data_begin
data
);
closure_text_offset
descriptor
_
/*text_resource_n*/
header
closure_text_offset
descriptor
_
/*text_resource_n*/
header
...
@@ -189,9 +195,15 @@ get_closure_name :: !Int .a .b !Header !{#Char} !{#Char} -> .(!{#Char},!{#Char})
...
@@ -189,9 +195,15 @@ get_closure_name :: !Int .a .b !Header !{#Char} !{#Char} -> .(!{#Char},!{#Char})
get_closure_name
text_offset
arity
text_resource_n
header
text
data
get_closure_name
text_offset
arity
text_resource_n
header
text
data
#
descriptor_pointer
=
text
LONG
(
text_offset
-
4
);
#
descriptor_pointer
=
text
LONG
(
text_offset
-
4
);
#
descriptor_offset
=
address_to_data_offset
descriptor_pointer
header
.
data_begin
data
;
#
descriptor_offset
=
address_to_data_offset
descriptor_pointer
header
.
data_begin
data
;
#
descriptor_max_arity_offset
=
descriptor_offset
+
(
data
WORD
(
descriptor_offset
+2
));
#!
function_name_offset
=
descriptor_max_arity_offset
+12
;
#
module_name_pointer
=
data
LONG
(
descriptor_max_arity_offset
+
8
);
/*
# descriptor_arity=data WORD (descriptor_offset-2);
# descriptor_arity=data WORD (descriptor_offset-2);
#! function_name_offset = descriptor_offset+4+(descriptor_arity<<3);
#! function_name_offset = descriptor_offset+4+(descriptor_arity<<3);
#! module_name_pointer = data LONG (descriptor_offset - 12);
#! module_name_pointer = data LONG (descriptor_offset - 12);
*/
=
(
get_string_from_offset
function_name_offset
data
,
get_string_from_pointer
module_name_pointer
header
.
data_begin
data
);
=
(
get_string_from_offset
function_name_offset
data
,
get_string_from_pointer
module_name_pointer
header
.
data_begin
data
);
record_name
::
!
Header
!
Int
!{#
Char
}
.
b
->
.(!{#
Char
},!{#
Char
});
record_name
::
!
Header
!
Int
!{#
Char
}
.
b
->
.(!{#
Char
},!{#
Char
});
...
@@ -208,6 +220,8 @@ record_name header data_offset data text
...
@@ -208,6 +220,8 @@ record_name header data_offset data text
((
string
BYTE
i
)
bitor
(
string
BYTE
(
i
+1
)
<<
8
));
((
string
BYTE
i
)
bitor
(
string
BYTE
(
i
+1
)
<<
8
));
(
LONG
)
::
!{#
Char
}
!
Int
->
Int
;
(
LONG
)
::
!{#
Char
}
!
Int
->
Int
;
(
LONG
)
string
i
=
IF_BIG_ENDIAN
(
LONG
)
string
i
((
string
BYTE
i
<<
24
)
bitor
(
string
BYTE
(
i
+1
)<<
16
)
bitor
(
string
BYTE
(
i
+2
)<<
8
)
bitor
(
string
BYTE
(
i
+3
)))
#
r
=
IF_BIG_ENDIAN
(((
string
BYTE
i
)
bitor
(
string
BYTE
(
i
+1
)
<<
8
)
bitor
(
string
BYTE
(
i
+2
)
<<
16
)
bitor
(
string
BYTE
(
i
+3
)
<<
24
)));
((
string
BYTE
i
<<
24
)
bitor
(
string
BYTE
(
i
+1
)<<
16
)
bitor
(
string
BYTE
(
i
+2
)<<
8
)
bitor
(
string
BYTE
(
i
+3
)))
(((
string
BYTE
i
)
bitor
(
string
BYTE
(
i
+1
)
<<
8
)
bitor
(
string
BYTE
(
i
+2
)
<<
16
)
bitor
(
string
BYTE
(
i
+3
)
<<
24
)));
=
IF_INT_64_OR_32
((
r
<<
32
)>>
32
)
r
;
HeapProfile/file_exists.c
View file @
dc8f107e
#include <windows.h>
#include <windows.h>
typedef
struct
clean_string
typedef
struct
clean_string
{
in
t
length
;
{
size_
t
length
;
char
characters
[
1
];
char
characters
[
1
];
}
*
CLEAN_STRING
;
}
*
CLEAN_STRING
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment