Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c9bf5250
Commit
c9bf5250
authored
Apr 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store offsets instead of pointers in the debug_info structure.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f438ff56
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
24 deletions
+17
-24
debugtools.c
dlls/ntdll/debugtools.c
+12
-18
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+4
-4
thread.c
dlls/ntdll/thread.c
+1
-2
No files found.
dlls/ntdll/debugtools.c
View file @
c9bf5250
...
...
@@ -47,25 +47,20 @@ static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" };
/* get the debug info pointer for the current thread */
static
inline
struct
debug_info
*
get_info
(
void
)
{
if
(
!
init_done
)
{
if
(
!
initial_info
.
str_pos
)
initial_info
.
str_pos
=
initial_info
.
strings
;
if
(
!
initial_info
.
out_pos
)
initial_info
.
out_pos
=
initial_info
.
output
;
return
&
initial_info
;
}
if
(
!
init_done
)
return
&
initial_info
;
return
ntdll_get_thread_data
()
->
debug_info
;
}
/* add a string to the output buffer */
static
int
append_output
(
struct
debug_info
*
info
,
const
char
*
str
,
size_t
len
)
{
if
(
len
>=
sizeof
(
info
->
output
)
-
(
info
->
out_pos
-
info
->
output
)
)
if
(
len
>=
sizeof
(
info
->
output
)
-
info
->
out_pos
)
{
fprintf
(
stderr
,
"wine_dbg_output: debugstr buffer overflow (contents: '%s')
\n
"
,
info
->
output
);
info
->
out_pos
=
info
->
output
;
info
->
out_pos
=
0
;
abort
();
}
memcpy
(
info
->
out_pos
,
str
,
len
);
memcpy
(
info
->
out
put
+
info
->
out
_pos
,
str
,
len
);
info
->
out_pos
+=
len
;
return
len
;
}
...
...
@@ -223,12 +218,13 @@ unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel
const
char
*
__cdecl
__wine_dbg_strdup
(
const
char
*
str
)
{
struct
debug_info
*
info
=
get_info
();
char
*
re
s
=
info
->
str_pos
;
unsigned
int
po
s
=
info
->
str_pos
;
size_t
n
=
strlen
(
str
)
+
1
;
if
(
res
+
n
>
&
info
->
strings
[
sizeof
(
info
->
strings
)])
res
=
info
->
strings
;
info
->
str_pos
=
res
+
n
;
return
strcpy
(
res
,
str
);
assert
(
n
<=
sizeof
(
info
->
strings
)
);
if
(
pos
+
n
>
sizeof
(
info
->
strings
))
pos
=
0
;
info
->
str_pos
=
pos
+
n
;
return
memcpy
(
info
->
strings
+
pos
,
str
,
n
);
}
/***********************************************************************
...
...
@@ -243,8 +239,8 @@ int __cdecl __wine_dbg_output( const char *str )
if
(
end
)
{
ret
+=
append_output
(
info
,
str
,
end
+
1
-
str
);
write
(
2
,
info
->
output
,
info
->
out_pos
-
info
->
output
);
info
->
out_pos
=
info
->
output
;
write
(
2
,
info
->
output
,
info
->
out_pos
);
info
->
out_pos
=
0
;
str
=
end
+
1
;
}
if
(
*
str
)
ret
+=
append_output
(
info
,
str
,
strlen
(
str
));
...
...
@@ -264,7 +260,7 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
if
(
!
(
__wine_dbg_get_channel_flags
(
channel
)
&
(
1
<<
cls
)))
return
-
1
;
/* only print header if we are at the beginning of the line */
if
(
info
->
out_pos
>
info
->
output
)
return
0
;
if
(
info
->
out_pos
)
return
0
;
if
(
init_done
)
{
...
...
@@ -288,8 +284,6 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
*/
void
debug_init
(
void
)
{
if
(
!
initial_info
.
str_pos
)
initial_info
.
str_pos
=
initial_info
.
strings
;
if
(
!
initial_info
.
out_pos
)
initial_info
.
out_pos
=
initial_info
.
output
;
ntdll_get_thread_data
()
->
debug_info
=
&
initial_info
;
init_done
=
TRUE
;
}
dlls/ntdll/ntdll_misc.h
View file @
c9bf5250
...
...
@@ -221,10 +221,10 @@ extern enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRIN
struct
debug_info
{
char
*
str_pos
;
/* current position in strings buffer */
char
*
out_pos
;
/* current position in output buffer */
char
strings
[
1024
];
/* buffer for temporary strings */
char
output
[
1024
];
/* current output line */
unsigned
int
str_pos
;
/* current position in strings buffer */
unsigned
int
out_pos
;
/* current position in output buffer */
char
strings
[
1024
];
/* buffer for temporary strings */
char
output
[
1024
];
/* current output line */
};
/* thread private data, stored in NtCurrentTeb()->GdiTebBatch */
...
...
dlls/ntdll/thread.c
View file @
c9bf5250
...
...
@@ -367,8 +367,7 @@ static void start_thread( struct startup_info *info )
struct
ntdll_thread_data
*
thread_data
=
(
struct
ntdll_thread_data
*
)
&
teb
->
GdiTebBatch
;
struct
debug_info
debug_info
;
debug_info
.
str_pos
=
debug_info
.
strings
;
debug_info
.
out_pos
=
debug_info
.
output
;
debug_info
.
str_pos
=
debug_info
.
out_pos
=
0
;
thread_data
->
debug_info
=
&
debug_info
;
thread_data
->
pthread_id
=
pthread_self
();
...
...
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