Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-ide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
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
Show 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;
text_addresses
::
!{#
Int
}
// for 68k
};
import
code
from
"file_exists.
obj
"
;
import
code
from
"file_exists."
;
PCorMac
pc
mac
:==
pc
;
...
...
@@ -56,7 +56,7 @@ read_application file_name application_file_name header files
|
not
ok
=
abort
"invalid application 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
;
#!
(
ok
,
files
)
=
fclose
app_file
files
;
|
not
ok
...
...
@@ -78,8 +78,8 @@ read_application file_name application_file_name header files
ReadCOFFHeader
app_file
#!
(
coff_header
,
app_file
)
=
freads
app_file
20
#!
machine
=
coff_header
WORD
0
;
|
machine
<>
0x14c
=
abort
(
"invalid application file for i386
"
);
|
machine
<>
IF_INT_64_OR_32
0x8664
0x14c
=
abort
(
"invalid application file for i386
: "
+++
toString
machine
);
#!
n_sections
=
coff_header
WORD
2
;
#!
optional_header_size
=
coff_header
WORD
16
;
#!
characteristics
=
coff_header
WORD
18
;
...
...
@@ -90,16 +90,17 @@ read_application file_name application_file_name header files
ReadOptionalHeader
app_file
optional_header_size
#!
(
optional_header
,
app_file
)
=
freads
app_file
optional_header_size
;
#!
magic
=
optional_header
WORD
0
;
|
magic
<>
0x10b
|
magic
<>
IF_INT_64_OR_32
0x20b
0x10b
=
abort
(
"incorrect magic number"
);
#!
code_size
=
optional_header
LONG
4
;
#!
data_size
=
optional_header
LONG
8
;
#!
base_of_code
=
optional_header
LONG
20
;
#!
base_of_data
=
optional_header
LONG
24
;
#!
image_base
=
optional_header
LONG
28
;
#!
image_base
=
IF_INT_64_OR_32
(((
optional_header
LONG
24
)
bitand
0xffffffff
)
+
(
optional_header
LONG
28
<<
32
))
(
optional_header
LONG
28
);
#!
section_alignment
=
optional_header
LONG
32
;
#!
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
|
(
section_n
==
n_sections
)
...
...
@@ -171,10 +172,15 @@ get_string_from_offset name_offset data
constructor_name
::
!
Int
!
Int
!
Int
!{#
Char
}
{#
Char
}
->
(!{#
Char
},!{#
Char
});
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));
# total_descriptor_arity = data WORD (nameP - 2);
#! string_offset = nameP+4 + (total_descriptor_arity << 3);
# module_name_pointer = data LONG (nameP - 12);
*/
=
(
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
...
...
@@ -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
#
descriptor_pointer
=
text
LONG
(
text_offset
-
4
);
#
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);
#! function_name_offset = descriptor_offset+4+(descriptor_arity<<3);
#! 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
);
record_name
::
!
Header
!
Int
!{#
Char
}
.
b
->
.(!{#
Char
},!{#
Char
});
...
...
@@ -208,6 +220,8 @@ record_name header data_offset data text
((
string
BYTE
i
)
bitor
(
string
BYTE
(
i
+1
)
<<
8
));
(
LONG
)
::
!{#
Char
}
!
Int
->
Int
;
(
LONG
)
string
i
=
IF_BIG_ENDIAN
(
LONG
)
string
i
#
r
=
IF_BIG_ENDIAN
((
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>
typedef
struct
clean_string
{
in
t
length
;
{
size_
t
length
;
char
characters
[
1
];
}
*
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