Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360201
b: refs/heads/master
c: 00370b8
h: refs/heads/master
i:
  360199: a84287a
v: v3
  • Loading branch information
Matt Klein authored and Jason Wessel committed Mar 2, 2013
1 parent b840495 commit 217f9b3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5f784f798c1a6367d314b3ea5d742a5dcc8dc7ca
refs/heads/master: 00370b8f8dd6e3171b8202f9c5187a5f73e99497
2 changes: 2 additions & 0 deletions trunk/kernel/debug/debug_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ extern int dbg_kdb_mode;
#ifdef CONFIG_KGDB_KDB
extern int kdb_stub(struct kgdb_state *ks);
extern int kdb_parse(const char *cmdstr);
extern int kdb_common_init_state(struct kgdb_state *ks);
extern int kdb_common_deinit_state(void);
#else /* ! CONFIG_KGDB_KDB */
static inline int kdb_stub(struct kgdb_state *ks)
{
Expand Down
3 changes: 3 additions & 0 deletions trunk/kernel/debug/gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,10 @@ static void gdb_cmd_query(struct kgdb_state *ks)
len = len / 2;
remcom_out_buffer[len++] = 0;

kdb_common_init_state(ks);
kdb_parse(remcom_out_buffer);
kdb_common_deinit_state();

strcpy(remcom_out_buffer, "OK");
}
break;
Expand Down
24 changes: 18 additions & 6 deletions trunk/kernel/debug/kdb/kdb_debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ EXPORT_SYMBOL_GPL(kdb_poll_idx);

static struct kgdb_state *kdb_ks;

int kdb_common_init_state(struct kgdb_state *ks)
{
kdb_initial_cpu = atomic_read(&kgdb_active);
kdb_current_task = kgdb_info[ks->cpu].task;
kdb_current_regs = kgdb_info[ks->cpu].debuggerinfo;
return 0;
}

int kdb_common_deinit_state(void)
{
kdb_initial_cpu = -1;
kdb_current_task = NULL;
kdb_current_regs = NULL;
return 0;
}

int kdb_stub(struct kgdb_state *ks)
{
int error = 0;
Expand Down Expand Up @@ -94,9 +110,7 @@ int kdb_stub(struct kgdb_state *ks)
}
/* Set initial kdb state variables */
KDB_STATE_CLEAR(KGDB_TRANS);
kdb_initial_cpu = atomic_read(&kgdb_active);
kdb_current_task = kgdb_info[ks->cpu].task;
kdb_current_regs = kgdb_info[ks->cpu].debuggerinfo;
kdb_common_init_state(ks);
/* Remove any breakpoints as needed by kdb and clear single step */
kdb_bp_remove();
KDB_STATE_CLEAR(DOING_SS);
Expand Down Expand Up @@ -125,9 +139,7 @@ int kdb_stub(struct kgdb_state *ks)
* Upon exit from the kdb main loop setup break points and restart
* the system based on the requested continue state
*/
kdb_initial_cpu = -1;
kdb_current_task = NULL;
kdb_current_regs = NULL;
kdb_common_deinit_state();
KDB_STATE_CLEAR(PAGER);
kdbnearsym_cleanup();
if (error == KDB_CMD_KGDB) {
Expand Down

0 comments on commit 217f9b3

Please sign in to comment.