Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204949
b: refs/heads/master
c: 84a0bd5
h: refs/heads/master
i:
  204947: cc03b0c
v: v3
  • Loading branch information
Jason Wessel committed Aug 5, 2010
1 parent 7c2c551 commit 8f1dedb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 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: a9fa20a7af1f152d2d89c44c274a310ac654e3ad
refs/heads/master: 84a0bd5b2830722cf80ff6ad33ef98101a947e14
37 changes: 19 additions & 18 deletions trunk/kernel/debug/gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,28 +367,31 @@ static void error_packet(char *pkt, int error)
* remapped to negative TIDs.
*/

#define BUF_THREAD_ID_SIZE 16
#define BUF_THREAD_ID_SIZE 8

static char *pack_threadid(char *pkt, unsigned char *id)
{
char *limit;
unsigned char *limit;
int lzero = 1;

limit = id + (BUF_THREAD_ID_SIZE / 2);
while (id < limit) {
if (!lzero || *id != 0) {
pkt = pack_hex_byte(pkt, *id);
lzero = 0;
}
id++;
}

limit = pkt + BUF_THREAD_ID_SIZE;
while (pkt < limit)
pkt = pack_hex_byte(pkt, *id++);
if (lzero)
pkt = pack_hex_byte(pkt, 0);

return pkt;
}

static void int_to_threadref(unsigned char *id, int value)
{
unsigned char *scan;
int i = 4;

scan = (unsigned char *)id;
while (i--)
*scan++ = 0;
put_unaligned_be32(value, scan);
put_unaligned_be32(value, id);
}

static struct task_struct *getthread(struct pt_regs *regs, int tid)
Expand Down Expand Up @@ -601,7 +604,7 @@ static void gdb_cmd_query(struct kgdb_state *ks)
{
struct task_struct *g;
struct task_struct *p;
unsigned char thref[8];
unsigned char thref[BUF_THREAD_ID_SIZE];
char *ptr;
int i;
int cpu;
Expand All @@ -621,8 +624,7 @@ static void gdb_cmd_query(struct kgdb_state *ks)
for_each_online_cpu(cpu) {
ks->thr_query = 0;
int_to_threadref(thref, -cpu - 2);
pack_threadid(ptr, thref);
ptr += BUF_THREAD_ID_SIZE;
ptr = pack_threadid(ptr, thref);
*(ptr++) = ',';
i++;
}
Expand All @@ -631,8 +633,7 @@ static void gdb_cmd_query(struct kgdb_state *ks)
do_each_thread(g, p) {
if (i >= ks->thr_query && !finished) {
int_to_threadref(thref, p->pid);
pack_threadid(ptr, thref);
ptr += BUF_THREAD_ID_SIZE;
ptr = pack_threadid(ptr, thref);
*(ptr++) = ',';
ks->thr_query++;
if (ks->thr_query % KGDB_MAX_THREAD_QUERY == 0)
Expand Down Expand Up @@ -851,7 +852,7 @@ int gdb_serial_stub(struct kgdb_state *ks)
memset(remcom_out_buffer, 0, sizeof(remcom_out_buffer));

if (kgdb_connected) {
unsigned char thref[8];
unsigned char thref[BUF_THREAD_ID_SIZE];
char *ptr;

/* Reply to host that an exception has occurred */
Expand Down

0 comments on commit 8f1dedb

Please sign in to comment.