Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198270
b: refs/heads/master
c: 7ca8b9c
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Linus Torvalds committed May 25, 2010
1 parent 5d0c4db commit 1ceb954
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 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: c6f6b596a5a73e63e5e930c414375c0c389199ab
refs/heads/master: 7ca8b9c0dafd1cb36289aa4c92c7beae7adcd34f
7 changes: 7 additions & 0 deletions trunk/arch/frv/include/asm/gdb-stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef __ASM_GDB_STUB_H
#define __ASM_GDB_STUB_H

#undef GDBSTUB_DEBUG_IO
#undef GDBSTUB_DEBUG_PROTOCOL

#include <asm/ptrace.h>
Expand Down Expand Up @@ -108,6 +109,12 @@ extern void gdbstub_printk(const char *fmt, ...);
extern void debug_to_serial(const char *p, int n);
extern void console_set_baud(unsigned baud);

#ifdef GDBSTUB_DEBUG_IO
#define gdbstub_io(FMT,...) gdbstub_printk(FMT, ##__VA_ARGS__)
#else
#define gdbstub_io(FMT,...) ({ 0; })
#endif

#ifdef GDBSTUB_DEBUG_PROTOCOL
#define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__)
#else
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/frv/kernel/gdb-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ int gdbstub_rx_char(unsigned char *_ch, int nonblock)
return -EINTR;
}
else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) {
gdbstub_proto("### GDB Rx Error (st=%02x) ###\n",st);
gdbstub_io("### GDB Rx Error (st=%02x) ###\n",st);
return -EIO;
}
else {
gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n",ch,st);
gdbstub_io("### GDB Rx %02x (st=%02x) ###\n",ch,st);
*_ch = ch & 0x7f;
return 0;
}
Expand Down
61 changes: 61 additions & 0 deletions trunk/arch/frv/kernel/gdb-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,44 @@ void gdbstub_get_mmu_state(void)

} /* end gdbstub_get_mmu_state() */

/*
* handle general query commands of the form 'qXXXXX'
*/
static void gdbstub_handle_query(void)
{
if (strcmp(input_buffer, "qAttached") == 0) {
/* return current thread ID */
sprintf(output_buffer, "1");
return;
}

if (strcmp(input_buffer, "qC") == 0) {
/* return current thread ID */
sprintf(output_buffer, "QC 0");
return;
}

if (strcmp(input_buffer, "qOffsets") == 0) {
/* return relocation offset of text and data segments */
sprintf(output_buffer, "Text=0;Data=0;Bss=0");
return;
}

if (strcmp(input_buffer, "qSymbol::") == 0) {
sprintf(output_buffer, "OK");
return;
}

if (strcmp(input_buffer, "qSupported") == 0) {
/* query of supported features */
sprintf(output_buffer, "PacketSize=%u;ReverseContinue-;ReverseStep-",
sizeof(input_buffer));
return;
}

gdbstub_strcpy(output_buffer,"E01");
}

/*****************************************************************************/
/*
* handle event interception and GDB remote protocol processing
Expand Down Expand Up @@ -1840,6 +1878,10 @@ void gdbstub(int sigval)
case 'k' :
goto done; /* just continue */

/* detach */
case 'D':
gdbstub_strcpy(output_buffer, "OK");
break;

/* reset the whole machine (FIXME: system dependent) */
case 'r':
Expand All @@ -1852,6 +1894,14 @@ void gdbstub(int sigval)
__debug_status.dcr |= DCR_SE;
goto done;

/* extended command */
case 'v':
if (strcmp(input_buffer, "vCont?") == 0) {
output_buffer[0] = 0;
break;
}
goto unsupported_cmd;

/* set baud rate (bBB) */
case 'b':
ptr = &input_buffer[1];
Expand Down Expand Up @@ -1923,8 +1973,19 @@ void gdbstub(int sigval)
gdbstub_strcpy(output_buffer,"OK");
break;

/* Thread-setting packet */
case 'H':
gdbstub_strcpy(output_buffer, "OK");
break;

case 'q':
gdbstub_handle_query();
break;

default:
unsupported_cmd:
gdbstub_proto("### GDB Unsupported Cmd '%s'\n",input_buffer);
gdbstub_strcpy(output_buffer,"E01");
break;
}

Expand Down

0 comments on commit 1ceb954

Please sign in to comment.