Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f4ec583d
Commit
f4ec583d
authored
Dec 10, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: Keep track of requests sizes and alignments in make_requests.
parent
37f3691f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
29 deletions
+47
-29
make_requests
tools/make_requests
+47
-29
No files found.
tools/make_requests
View file @
f4ec583d
...
@@ -22,31 +22,31 @@
...
@@ -22,31 +22,31 @@
use
strict
;
use
strict
;
my
%
formats
=
my
%
formats
=
(
(
# size align format
"int"
=>
"%d"
,
"int"
=>
[
4
,
4
,
"%d"
]
,
"short int"
=>
"%d"
,
"short int"
=>
[
2
,
2
,
"%d"
]
,
"char"
=>
"%c"
,
"char"
=>
[
1
,
1
,
"%c"
]
,
"unsigned char"
=>
"%02x"
,
"unsigned char"
=>
[
1
,
1
,
"%02x"
]
,
"unsigned short"
=>
"%04x"
,
"unsigned short"
=>
[
2
,
2
,
"%04x"
]
,
"unsigned int"
=>
"%08x"
,
"unsigned int"
=>
[
4
,
4
,
"%08x"
]
,
"unsigned long"
=>
"%lx"
,
"unsigned long"
=>
[
4
,
4
,
"%lx"
]
,
"void*"
=>
"%p"
,
"void*"
=>
[
4
,
4
,
"%p"
]
,
"data_size_t"
=>
"%u"
,
"data_size_t"
=>
[
4
,
4
,
"%u"
]
,
"obj_handle_t"
=>
"%04x"
,
"obj_handle_t"
=>
[
4
,
4
,
"%04x"
]
,
"atom_t"
=>
"%04x"
,
"atom_t"
=>
[
2
,
2
,
"%04x"
]
,
"user_handle_t"
=>
"%08x"
,
"user_handle_t"
=>
[
4
,
4
,
"%08x"
]
,
"process_id_t"
=>
"%04x"
,
"process_id_t"
=>
[
4
,
4
,
"%04x"
]
,
"thread_id_t"
=>
"%04x"
,
"thread_id_t"
=>
[
4
,
4
,
"%04x"
]
,
"lparam_t"
=>
"%lx"
,
"lparam_t"
=>
[
4
,
4
,
"%lx"
]
,
"timeout_t"
=>
"&dump_timeout"
,
"timeout_t"
=>
[
8
,
8
,
"&dump_timeout"
]
,
"rectangle_t"
=>
"&dump_rectangle"
,
"rectangle_t"
=>
[
16
,
4
,
"&dump_rectangle"
]
,
"char_info_t"
=>
"&dump_char_info"
,
"char_info_t"
=>
[
4
,
2
,
"&dump_char_info"
]
,
"apc_call_t"
=>
"&dump_apc_call"
,
"apc_call_t"
=>
[
32
,
4
,
"&dump_apc_call"
]
,
"apc_result_t"
=>
"&dump_apc_result"
,
"apc_result_t"
=>
[
28
,
4
,
"&dump_apc_result"
]
,
"async_data_t"
=>
"&dump_async_data"
,
"async_data_t"
=>
[
28
,
4
,
"&dump_async_data"
]
,
"luid_t"
=>
"&dump_luid"
,
"luid_t"
=>
[
8
,
4
,
"&dump_luid"
]
,
"ioctl_code_t"
=>
"&dump_ioctl_code"
,
"ioctl_code_t"
=>
[
4
,
4
,
"&dump_ioctl_code"
]
,
"file_pos_t"
=>
"&dump_file_pos"
,
"file_pos_t"
=>
[
8
,
8
,
"&dump_file_pos"
]
,
);
);
my
@requests
=
();
my
@requests
=
();
...
@@ -54,7 +54,9 @@ my %replies = ();
...
@@ -54,7 +54,9 @@ my %replies = ();
my
@trace_lines
=
();
my
@trace_lines
=
();
my
$max_req_size
=
64
;
my
$warnings
=
scalar
(
@ARGV
)
&&
$ARGV
[
0
]
eq
"-w"
;
### Generate a dumping function
### Generate a dumping function
...
@@ -69,14 +71,15 @@ sub DO_DUMP_FUNC($$@)
...
@@ -69,14 +71,15 @@ sub DO_DUMP_FUNC($$@)
my
$var
=
shift
;
my
$var
=
shift
;
if
(
defined
(
$formats
{
$type
}))
if
(
defined
(
$formats
{
$type
}))
{
{
if
(
$formats
{
$type
}
=~
/^&(.*)/
)
my
$fmt
=
$
{
$formats
{
$type
}}[
2
];
if
(
$fmt
=~
/^&(.*)/
)
{
{
my
$func
=
$1
;
my
$func
=
$1
;
push
@trace_lines
,
" fprintf( stderr, \" $var=\" );\n"
;
push
@trace_lines
,
" fprintf( stderr, \" $var=\" );\n"
;
push
@trace_lines
,
" $func( &req->$var );\n"
;
push
@trace_lines
,
" $func( &req->$var );\n"
;
push
@trace_lines
,
" fprintf( stderr, \",\" );\n"
if
(
$#_
>
0
);
push
@trace_lines
,
" fprintf( stderr, \",\" );\n"
if
(
$#_
>
0
);
}
}
elsif
(
$f
ormats
{
$type
}
=~
/^(%.*)\s+\((.*)\)/
)
elsif
(
$f
mt
=~
/^(%.*)\s+\((.*)\)/
)
{
{
my
(
$format
,
$cast
)
=
(
$1
,
$2
);
my
(
$format
,
$cast
)
=
(
$1
,
$2
);
push
@trace_lines
,
" fprintf( stderr, \" $var=$format"
;
push
@trace_lines
,
" fprintf( stderr, \" $var=$format"
;
...
@@ -85,7 +88,7 @@ sub DO_DUMP_FUNC($$@)
...
@@ -85,7 +88,7 @@ sub DO_DUMP_FUNC($$@)
}
}
else
else
{
{
push
@trace_lines
,
" fprintf( stderr, \" $var=$f
ormats{$type}
"
;
push
@trace_lines
,
" fprintf( stderr, \" $var=$f
mt
"
;
push
@trace_lines
,
","
if
(
$#_
>
0
);
push
@trace_lines
,
","
if
(
$#_
>
0
);
push
@trace_lines
,
"\", req->$var );\n"
;
push
@trace_lines
,
"\", req->$var );\n"
;
}
}
...
@@ -107,6 +110,7 @@ sub PARSE_REQUESTS()
...
@@ -107,6 +110,7 @@ sub PARSE_REQUESTS()
{
{
# states: 0 = header 1 = declarations 2 = inside @REQ 3 = inside @REPLY
# states: 0 = header 1 = declarations 2 = inside @REQ 3 = inside @REPLY
my
$state
=
0
;
my
$state
=
0
;
my
$offset
=
0
;
my
$name
=
""
;
my
$name
=
""
;
my
@in_struct
=
();
my
@in_struct
=
();
my
@out_struct
=
();
my
@out_struct
=
();
...
@@ -138,6 +142,7 @@ sub PARSE_REQUESTS()
...
@@ -138,6 +142,7 @@ sub PARSE_REQUESTS()
# start a new request
# start a new request
@in_struct
=
();
@in_struct
=
();
@out_struct
=
();
@out_struct
=
();
$offset
=
12
;
print
SERVER_PROT
"struct ${name}_request\n{\n"
;
print
SERVER_PROT
"struct ${name}_request\n{\n"
;
print
SERVER_PROT
" struct request_header __header;\n"
;
print
SERVER_PROT
" struct request_header __header;\n"
;
$state
++
;
$state
++
;
...
@@ -150,6 +155,8 @@ sub PARSE_REQUESTS()
...
@@ -150,6 +155,8 @@ sub PARSE_REQUESTS()
print
SERVER_PROT
"};\n"
;
print
SERVER_PROT
"};\n"
;
print
SERVER_PROT
"struct ${name}_reply\n{\n"
;
print
SERVER_PROT
"struct ${name}_reply\n{\n"
;
print
SERVER_PROT
" struct reply_header __header;\n"
;
print
SERVER_PROT
" struct reply_header __header;\n"
;
die
"request $name too large ($offset)"
if
(
$offset
>
$max_req_size
);
$offset
=
8
;
$state
++
;
$state
++
;
next
;
next
;
}
}
...
@@ -161,11 +168,15 @@ sub PARSE_REQUESTS()
...
@@ -161,11 +168,15 @@ sub PARSE_REQUESTS()
if
(
$state
==
2
)
# build dummy reply struct
if
(
$state
==
2
)
# build dummy reply struct
{
{
die
"request $name too large ($offset)"
if
(
$offset
>
$max_req_size
);
print
SERVER_PROT
"struct ${name}_reply\n{\n"
;
print
SERVER_PROT
"struct ${name}_reply\n{\n"
;
print
SERVER_PROT
" struct reply_header __header;\n"
;
print
SERVER_PROT
" struct reply_header __header;\n"
;
print
SERVER_PROT
"};\n"
;
print
SERVER_PROT
"};\n"
;
}
}
else
{
die
"reply $name too large ($offset)"
if
(
$offset
>
$max_req_size
);
}
# got a complete request
# got a complete request
push
@requests
,
$name
;
push
@requests
,
$name
;
DO_DUMP_FUNC
(
$name
,
"request"
,
@in_struct
);
DO_DUMP_FUNC
(
$name
,
"request"
,
@in_struct
);
...
@@ -204,6 +215,13 @@ sub PARSE_REQUESTS()
...
@@ -204,6 +215,13 @@ sub PARSE_REQUESTS()
$type
=
$1
;
$type
=
$1
;
$var
=
$3
;
$var
=
$3
;
die
"Unrecognized type $type"
unless
defined
(
$formats
{
$type
});
die
"Unrecognized type $type"
unless
defined
(
$formats
{
$type
});
my
@fmt
=
@
{
$formats
{
$type
}};
if
(
$offset
&
(
$fmt
[
1
]
-
1
))
{
print
"protocol.def:$.: warning: $name $offset $type $var needs padding\n"
if
$warnings
;
}
$offset
=
(
$offset
+
$fmt
[
1
]
-
1
)
&
~
(
$fmt
[
1
]
-
1
);
$offset
+=
$fmt
[
0
];
}
}
else
else
{
{
...
...
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