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
addd324d
Commit
addd324d
authored
Oct 25, 2012
by
André Hentschel
Committed by
Alexandre Julliard
Oct 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Cleanup if gdb startup fails (coverity).
parent
904cdc46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
gdbproxy.c
programs/winedbg/gdbproxy.c
+12
-9
No files found.
programs/winedbg/gdbproxy.c
View file @
addd324d
...
@@ -2292,6 +2292,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
...
@@ -2292,6 +2292,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
unsigned
int
s_len
=
sizeof
(
s_addrs
);
unsigned
int
s_len
=
sizeof
(
s_addrs
);
struct
pollfd
pollfd
;
struct
pollfd
pollfd
;
IMAGEHLP_MODULE64
imh_mod
;
IMAGEHLP_MODULE64
imh_mod
;
BOOL
ret
=
FALSE
;
/* step 1: create socket for gdb connection request */
/* step 1: create socket for gdb connection request */
if
((
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
-
1
)
if
((
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
-
1
)
...
@@ -2301,15 +2302,15 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
...
@@ -2301,15 +2302,15 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
return
FALSE
;
return
FALSE
;
}
}
if
(
listen
(
sock
,
1
)
==
-
1
||
if
(
listen
(
sock
,
1
)
==
-
1
||
getsockname
(
sock
,
(
struct
sockaddr
*
)
&
s_addrs
,
&
s_len
)
==
-
1
)
getsockname
(
sock
,
(
struct
sockaddr
*
)
&
s_addrs
,
&
s_len
)
==
-
1
)
goto
cleanup
;
return
FALSE
;
/* step 2: do the process internal creation */
/* step 2: do the process internal creation */
handle_debug_event
(
gdbctx
,
de
);
handle_debug_event
(
gdbctx
,
de
);
/* step3: get the wine loader name */
/* step3: get the wine loader name */
if
(
!
dbg_get_debuggee_info
(
gdbctx
->
process
->
handle
,
&
imh_mod
))
return
FALSE
;
if
(
!
dbg_get_debuggee_info
(
gdbctx
->
process
->
handle
,
&
imh_mod
))
goto
cleanup
;
/* step 4: fire up gdb (if requested) */
/* step 4: fire up gdb (if requested) */
if
(
flags
&
FLAG_NO_START
)
if
(
flags
&
FLAG_NO_START
)
...
@@ -2319,14 +2320,14 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
...
@@ -2319,14 +2320,14 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
{
{
case
-
1
:
/* error in parent... */
case
-
1
:
/* error in parent... */
fprintf
(
stderr
,
"Cannot create gdb
\n
"
);
fprintf
(
stderr
,
"Cannot create gdb
\n
"
);
return
FALSE
;
goto
cleanup
;
default:
/* in parent... success */
default:
/* in parent... success */
signal
(
SIGINT
,
SIG_IGN
);
signal
(
SIGINT
,
SIG_IGN
);
break
;
break
;
case
0
:
/* in child... and alive */
case
0
:
/* in child... and alive */
gdb_exec
(
imh_mod
.
LoadedImageName
,
s_addrs
.
sin_port
,
flags
);
gdb_exec
(
imh_mod
.
LoadedImageName
,
s_addrs
.
sin_port
,
flags
);
/* if we're here, exec failed, so report failure */
/* if we're here, exec failed, so report failure */
return
FALSE
;
goto
cleanup
;
}
}
/* step 5: wait for gdb to connect actually */
/* step 5: wait for gdb to connect actually */
...
@@ -2343,6 +2344,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
...
@@ -2343,6 +2344,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
gdbctx
->
sock
=
accept
(
sock
,
(
struct
sockaddr
*
)
&
s_addrs
,
&
s_len
);
gdbctx
->
sock
=
accept
(
sock
,
(
struct
sockaddr
*
)
&
s_addrs
,
&
s_len
);
if
(
gdbctx
->
sock
==
-
1
)
if
(
gdbctx
->
sock
==
-
1
)
break
;
break
;
ret
=
TRUE
;
if
(
gdbctx
->
trace
&
GDBPXY_TRC_LOWLEVEL
)
if
(
gdbctx
->
trace
&
GDBPXY_TRC_LOWLEVEL
)
fprintf
(
stderr
,
"Connected on %d
\n
"
,
gdbctx
->
sock
);
fprintf
(
stderr
,
"Connected on %d
\n
"
,
gdbctx
->
sock
);
/* don't keep our small packets too long: send them ASAP back to GDB
/* don't keep our small packets too long: send them ASAP back to GDB
...
@@ -2354,17 +2356,18 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
...
@@ -2354,17 +2356,18 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
case
0
:
case
0
:
if
(
gdbctx
->
trace
&
GDBPXY_TRC_LOWLEVEL
)
if
(
gdbctx
->
trace
&
GDBPXY_TRC_LOWLEVEL
)
fprintf
(
stderr
,
"Poll for cnx failed (timeout)
\n
"
);
fprintf
(
stderr
,
"Poll for cnx failed (timeout)
\n
"
);
return
FALSE
;
break
;
case
-
1
:
case
-
1
:
if
(
gdbctx
->
trace
&
GDBPXY_TRC_LOWLEVEL
)
if
(
gdbctx
->
trace
&
GDBPXY_TRC_LOWLEVEL
)
fprintf
(
stderr
,
"Poll for cnx failed (error)
\n
"
);
fprintf
(
stderr
,
"Poll for cnx failed (error)
\n
"
);
return
FALSE
;
break
;
default:
default:
assert
(
0
);
assert
(
0
);
}
}
cleanup:
close
(
sock
);
close
(
sock
);
return
TRUE
;
return
ret
;
}
}
static
BOOL
gdb_init_context
(
struct
gdb_context
*
gdbctx
,
unsigned
flags
)
static
BOOL
gdb_init_context
(
struct
gdb_context
*
gdbctx
,
unsigned
flags
)
...
...
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