Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
card10
openocd
Commits
c8d935ab
Commit
c8d935ab
authored
Oct 12, 2009
by
Øyvind Harboe
Browse files
If halt times out, stop GDB. Allows e.g. manual reset via monitor commands.
parent
b23b096c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/server/gdb_server.c
View file @
c8d935ab
...
...
@@ -2194,10 +2194,13 @@ int gdb_input_inner(connection_t *connection)
retval
=
target_halt
(
target
);
if
(
retval
!=
ERROR_OK
)
{
/* stop this debug session */
target_call_event_callbacks
(
target
,
TARGET_EVENT_GDB_HALT
);
}
gdb_con
->
ctrl_c
=
0
;
}
else
{
LOG_INFO
(
"The target is not running when halt was requested, stopping GDB."
);
target_call_event_callbacks
(
target
,
TARGET_EVENT_GDB_HALT
);
}
}
...
...
src/target/target.c
View file @
c8d935ab
...
...
@@ -378,24 +378,57 @@ target_t* get_current_target(command_context_t *cmd_ctx)
int
target_poll
(
struct
target_s
*
target
)
{
int
retval
;
/* We can't poll until after examine */
if
(
!
target_was_examined
(
target
))
{
/* Fail silently lest we pollute the log */
return
ERROR_FAIL
;
}
return
target
->
type
->
poll
(
target
);
retval
=
target
->
type
->
poll
(
target
);
if
(
retval
!=
ERROR_OK
)
return
retval
;
if
(
target
->
halt_issued
)
{
if
(
target
->
state
==
TARGET_HALTED
)
{
target
->
halt_issued
=
false
;
}
else
{
long
long
t
=
timeval_ms
()
-
target
->
halt_issued_time
;
if
(
t
>
1000
)
{
target
->
halt_issued
=
false
;
LOG_INFO
(
"Halt timed out, wake up GDB."
);
target_call_event_callbacks
(
target
,
TARGET_EVENT_GDB_HALT
);
}
}
}
return
ERROR_OK
;
}
int
target_halt
(
struct
target_s
*
target
)
{
int
retval
;
/* We can't poll until after examine */
if
(
!
target_was_examined
(
target
))
{
LOG_ERROR
(
"Target not examined yet"
);
return
ERROR_FAIL
;
}
return
target
->
type
->
halt
(
target
);
retval
=
target
->
type
->
halt
(
target
);
if
(
retval
!=
ERROR_OK
)
return
retval
;
target
->
halt_issued
=
true
;
target
->
halt_issued_time
=
timeval_ms
();
return
ERROR_OK
;
}
int
target_resume
(
struct
target_s
*
target
,
int
current
,
uint32_t
address
,
int
handle_breakpoints
,
int
debug_execution
)
...
...
@@ -4236,6 +4269,8 @@ static int target_create(Jim_GetOptInfo *goi)
target
->
display
=
1
;
target
->
halt_issued
=
false
;
/* initialize trace information */
target
->
trace_info
=
malloc
(
sizeof
(
trace_t
));
target
->
trace_info
->
num_trace_points
=
0
;
...
...
src/target/target.h
View file @
c8d935ab
...
...
@@ -148,6 +148,8 @@ typedef struct target_s
int
display
;
/* display async info in telnet session. Do not display
* lots of halted/resumed info when stepping in debugger. */
bool
halt_issued
;
/* did we transition to halted state? */
long
long
halt_issued_time
;
/* Note time when halt was issued */
}
target_t
;
enum
target_event
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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