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
a67f8e86
Commit
a67f8e86
authored
Feb 24, 2006
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 27, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Move gdb command line handling.
- moves gdb command line handling to gdbproxy.c - using manifest constants to make code more readable
parent
ac7be1e9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
31 deletions
+43
-31
debugger.h
programs/winedbg/debugger.h
+2
-2
gdbproxy.c
programs/winedbg/gdbproxy.c
+32
-3
winedbg.c
programs/winedbg/winedbg.c
+9
-26
No files found.
programs/winedbg/debugger.h
View file @
a67f8e86
...
@@ -373,7 +373,7 @@ extern void dbg_wait_next_exception(DWORD cont, int count, int mode)
...
@@ -373,7 +373,7 @@ extern void dbg_wait_next_exception(DWORD cont, int count, int mode)
extern
enum
dbg_start
dbg_active_attach
(
int
argc
,
char
*
argv
[]);
extern
enum
dbg_start
dbg_active_attach
(
int
argc
,
char
*
argv
[]);
extern
enum
dbg_start
dbg_active_launch
(
int
argc
,
char
*
argv
[]);
extern
enum
dbg_start
dbg_active_launch
(
int
argc
,
char
*
argv
[]);
/* temporary for tgt_active.c */
/* temporary for tgt_active.c */
extern
enum
dbg_action_mode
{
none_mode
=
0
,
winedbg_mode
,
automatic_mode
,
gdb_mode
}
dbg_action_mode
;
extern
enum
dbg_action_mode
{
none_mode
=
0
,
winedbg_mode
,
automatic_mode
}
dbg_action_mode
;
extern
unsigned
dbg_main_loop
(
HANDLE
);
extern
unsigned
dbg_main_loop
(
HANDLE
);
/* tgt_minidump.c */
/* tgt_minidump.c */
...
@@ -414,7 +414,7 @@ extern void dbg_del_thread(struct dbg_thread* t);
...
@@ -414,7 +414,7 @@ extern void dbg_del_thread(struct dbg_thread* t);
extern
BOOL
dbg_get_debuggee_info
(
HANDLE
hProcess
,
IMAGEHLP_MODULE
*
imh_mod
);
extern
BOOL
dbg_get_debuggee_info
(
HANDLE
hProcess
,
IMAGEHLP_MODULE
*
imh_mod
);
/* gdbproxy.c */
/* gdbproxy.c */
extern
BOOL
gdb_remote
(
unsigned
int
);
extern
int
gdb_main
(
int
argc
,
char
*
argv
[]
);
static
inline
BOOL
dbg_read_memory
(
const
void
*
addr
,
void
*
buffer
,
size_t
len
)
static
inline
BOOL
dbg_read_memory
(
const
void
*
addr
,
void
*
buffer
,
size_t
len
)
{
{
...
...
programs/winedbg/gdbproxy.c
View file @
a67f8e86
...
@@ -2042,6 +2042,9 @@ static int fetch_data(struct gdb_context* gdbctx)
...
@@ -2042,6 +2042,9 @@ static int fetch_data(struct gdb_context* gdbctx)
return
gdbctx
->
in_len
-
in_len
;
return
gdbctx
->
in_len
-
in_len
;
}
}
#define FLAG_NO_START 1
#define FLAG_WITH_XTERM 2
static
BOOL
gdb_exec
(
const
char
*
wine_path
,
unsigned
port
,
unsigned
flags
)
static
BOOL
gdb_exec
(
const
char
*
wine_path
,
unsigned
port
,
unsigned
flags
)
{
{
char
buf
[
MAX_PATH
];
char
buf
[
MAX_PATH
];
...
@@ -2071,7 +2074,7 @@ static BOOL gdb_exec(const char* wine_path, unsigned port, unsigned flags)
...
@@ -2071,7 +2074,7 @@ static BOOL gdb_exec(const char* wine_path, unsigned port, unsigned flags)
/* tell gdb to delete this file when done handling it... */
/* tell gdb to delete this file when done handling it... */
fprintf
(
f
,
"shell rm -f
\"
%s
\"\n
"
,
buf
);
fprintf
(
f
,
"shell rm -f
\"
%s
\"\n
"
,
buf
);
fclose
(
f
);
fclose
(
f
);
if
(
flags
&
2
)
if
(
flags
&
FLAG_WITH_XTERM
)
execlp
(
"xterm"
,
"xterm"
,
"-e"
,
gdb_path
,
"-x"
,
buf
,
NULL
);
execlp
(
"xterm"
,
"xterm"
,
"-e"
,
gdb_path
,
"-x"
,
buf
,
NULL
);
else
else
execlp
(
gdb_path
,
gdb_path
,
"-x"
,
buf
,
NULL
);
execlp
(
gdb_path
,
gdb_path
,
"-x"
,
buf
,
NULL
);
...
@@ -2106,7 +2109,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
...
@@ -2106,7 +2109,7 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
if
(
!
dbg_get_debuggee_info
(
gdbctx
->
process
->
handle
,
&
imh_mod
))
return
FALSE
;
if
(
!
dbg_get_debuggee_info
(
gdbctx
->
process
->
handle
,
&
imh_mod
))
return
FALSE
;
/* step 4: fire up gdb (if requested) */
/* step 4: fire up gdb (if requested) */
if
(
flags
&
1
)
if
(
flags
&
FLAG_NO_START
)
fprintf
(
stderr
,
"target remote localhost:%d
\n
"
,
ntohs
(
s_addrs
.
sin_port
));
fprintf
(
stderr
,
"target remote localhost:%d
\n
"
,
ntohs
(
s_addrs
.
sin_port
));
else
else
switch
(
fork
())
switch
(
fork
())
...
@@ -2205,7 +2208,7 @@ static BOOL gdb_init_context(struct gdb_context* gdbctx, unsigned flags)
...
@@ -2205,7 +2208,7 @@ static BOOL gdb_init_context(struct gdb_context* gdbctx, unsigned flags)
return
TRUE
;
return
TRUE
;
}
}
BOOL
gdb_remote
(
unsigned
flags
)
static
int
gdb_remote
(
unsigned
flags
)
{
{
struct
pollfd
pollfd
;
struct
pollfd
pollfd
;
struct
gdb_context
gdbctx
;
struct
gdb_context
gdbctx
;
...
@@ -2248,3 +2251,29 @@ BOOL gdb_remote(unsigned flags)
...
@@ -2248,3 +2251,29 @@ BOOL gdb_remote(unsigned flags)
wait
(
NULL
);
wait
(
NULL
);
return
0
;
return
0
;
}
}
int
gdb_main
(
int
argc
,
char
*
argv
[])
{
unsigned
gdb_flags
=
0
;
argc
--
;
argv
++
;
while
(
argc
>
0
&&
argv
[
0
][
0
]
==
'-'
)
{
if
(
strcmp
(
argv
[
0
],
"--no-start"
)
==
0
)
{
gdb_flags
|=
FLAG_NO_START
;
argc
--
;
argv
++
;
continue
;
}
if
(
strcmp
(
argv
[
0
],
"--with-xterm"
)
==
0
)
{
gdb_flags
|=
FLAG_WITH_XTERM
;
argc
--
;
argv
++
;
continue
;
}
return
-
1
;
}
if
(
dbg_active_attach
(
argc
,
argv
)
||
dbg_active_launch
(
argc
,
argv
))
return
gdb_remote
(
gdb_flags
);
return
-
1
;
}
programs/winedbg/winedbg.c
View file @
a67f8e86
...
@@ -446,7 +446,7 @@ static void dbg_init_console(void)
...
@@ -446,7 +446,7 @@ static void dbg_init_console(void)
static
int
dbg_winedbg_usage
(
void
)
static
int
dbg_winedbg_usage
(
void
)
{
{
dbg_printf
(
"Usage: winedbg [--command cmd|--file file|--auto] [--gdb [--no-start] [--with-xterm]] cmdline
\n
"
);
dbg_printf
(
"Usage: winedbg [--command cmd|--file file|--auto] [--gdb [--no-start] [--with-xterm]] cmdline
\n
"
);
return
1
;
return
-
1
;
}
}
struct
backend_cpu
*
be_cpu
;
struct
backend_cpu
*
be_cpu
;
...
@@ -462,8 +462,7 @@ extern struct backend_cpu be_alpha;
...
@@ -462,8 +462,7 @@ extern struct backend_cpu be_alpha;
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
DWORD
retv
=
0
;
int
retv
=
0
;
unsigned
gdb_flags
=
0
;
HANDLE
hFile
=
INVALID_HANDLE_VALUE
;
HANDLE
hFile
=
INVALID_HANDLE_VALUE
;
#ifdef __i386__
#ifdef __i386__
...
@@ -484,6 +483,13 @@ int main(int argc, char** argv)
...
@@ -484,6 +483,13 @@ int main(int argc, char** argv)
/* as we don't care about exec name */
/* as we don't care about exec name */
argc
--
;
argv
++
;
argc
--
;
argv
++
;
if
(
argc
&&
!
strcmp
(
argv
[
0
],
"--gdb"
))
{
retv
=
gdb_main
(
argc
,
argv
);
if
(
retv
==
-
1
)
dbg_winedbg_usage
();
return
retv
;
}
/* parse options */
/* parse options */
while
(
argc
>
0
&&
argv
[
0
][
0
]
==
'-'
)
while
(
argc
>
0
&&
argv
[
0
][
0
]
==
'-'
)
{
{
...
@@ -532,25 +538,6 @@ int main(int argc, char** argv)
...
@@ -532,25 +538,6 @@ int main(int argc, char** argv)
dbg_houtput
=
GetStdHandle
(
STD_ERROR_HANDLE
);
dbg_houtput
=
GetStdHandle
(
STD_ERROR_HANDLE
);
continue
;
continue
;
}
}
if
(
!
strcmp
(
argv
[
0
],
"--gdb"
))
{
if
(
dbg_action_mode
!=
none_mode
)
return
dbg_winedbg_usage
();
dbg_action_mode
=
gdb_mode
;
argc
--
;
argv
++
;
continue
;
}
if
(
strcmp
(
argv
[
0
],
"--no-start"
)
==
0
&&
dbg_action_mode
==
gdb_mode
)
{
gdb_flags
|=
1
;
argc
--
;
argv
++
;
continue
;
}
if
(
strcmp
(
argv
[
0
],
"--with-xterm"
)
==
0
&&
dbg_action_mode
==
gdb_mode
)
{
gdb_flags
|=
2
;
argc
--
;
argv
++
;
continue
;
}
return
dbg_winedbg_usage
();
return
dbg_winedbg_usage
();
}
}
...
@@ -558,10 +545,6 @@ int main(int argc, char** argv)
...
@@ -558,10 +545,6 @@ int main(int argc, char** argv)
if
(
!
argc
||
dbg_active_attach
(
argc
,
argv
)
==
start_ok
||
if
(
!
argc
||
dbg_active_attach
(
argc
,
argv
)
==
start_ok
||
dbg_active_launch
(
argc
,
argv
)
==
start_ok
)
dbg_active_launch
(
argc
,
argv
)
==
start_ok
)
{
{
/* don't save local vars in gdb mode */
if
(
dbg_action_mode
==
gdb_mode
&&
dbg_curr_pid
)
return
gdb_remote
(
gdb_flags
);
dbg_init_console
();
dbg_init_console
();
SymSetOptions
((
SymGetOptions
()
&
~
(
SYMOPT_UNDNAME
))
|
SymSetOptions
((
SymGetOptions
()
&
~
(
SYMOPT_UNDNAME
))
|
...
...
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