* Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c [not found] <1000915073306.ZM4195@ocotillo.lan> @ 2000-09-15 10:50 ` J.T. Conklin [not found] ` <1000915181249.ZM5172@ocotillo.lan> 0 siblings, 1 reply; 2+ messages in thread From: J.T. Conklin @ 2000-09-15 10:50 UTC (permalink / raw) To: Kevin Buettner; +Cc: gdb-patches >>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes: Kevin> I did three files this time because there was only one function that Kevin> needed doing in each of them. (The m88k-*.c files bring back old Kevin> memories; I first started hacking on gdb on an m88k box in the early Kevin> nineties.) Kevin> Kevin> * m32r-stub.c (prepare_to_step): Protoize. Should we consider not protoizing the *-stub.c files? While these are distributed with GDB, they are code that is going to be hacked to bits as they are integrated into a remote target. While user is probably using gcc, it may be reasonable to be as conservative we can when it comes to these files... --jtc -- J.T. Conklin RedBack Networks From shebs@apple.com Fri Sep 15 11:04:00 2000 From: Stan Shebs <shebs@apple.com> To: jtc@redback.com Cc: Kevin Buettner <kevinb@cygnus.com>, gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 11:04:00 -0000 Message-id: <39C2649F.36BE8BBD@apple.com> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> X-SW-Source: 2000-09/msg00139.html Content-length: 1136 "J.T. Conklin" wrote: > > >>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes: > Kevin> I did three files this time because there was only one function that > Kevin> needed doing in each of them. (The m88k-*.c files bring back old > Kevin> memories; I first started hacking on gdb on an m88k box in the early > Kevin> nineties.) > Kevin> > Kevin> * m32r-stub.c (prepare_to_step): Protoize. > > Should we consider not protoizing the *-stub.c files? While these are > distributed with GDB, they are code that is going to be hacked to bits > as they are integrated into a remote target. While user is probably > using gcc, it may be reasonable to be as conservative we can when it > comes to these files... It's a pretty safe bet that all m32r compilers are ISO! I thought about the stub code standard a while back, and concluded that since the stubs are effectively example code, they at least ought to be *good* examples. In fact, they're probably the most-looked-at sources in the whole GDB tree, so they should be exemplars of our recommended coding practices (suitably adjusted for the embedded case of course). Stan From kevinb@cygnus.com Fri Sep 15 11:13:00 2000 From: Kevin Buettner <kevinb@cygnus.com> To: jtc@redback.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 11:13:00 -0000 Message-id: <1000915181249.ZM5172@ocotillo.lan> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> X-SW-Source: 2000-09/msg00140.html Content-length: 1299 On Sep 15, 10:50am, J.T. Conklin wrote: > >>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes: > Kevin> I did three files this time because there was only one function that > Kevin> needed doing in each of them. (The m88k-*.c files bring back old > Kevin> memories; I first started hacking on gdb on an m88k box in the early > Kevin> nineties.) > Kevin> > Kevin> * m32r-stub.c (prepare_to_step): Protoize. > > Should we consider not protoizing the *-stub.c files? While these are > distributed with GDB, they are code that is going to be hacked to bits > as they are integrated into a remote target. While user is probably > using gcc, it may be reasonable to be as conservative we can when it > comes to these files... You're right. I think that Andrew (and perhaps others) warned me about this too. I hereby withdraw the m32r-stub.c portion of the patch. Also, I will need to revert many of the changes that occurred in my changes of 2000-07-29. Specifically, I'll need to revert the changes that were made to the following files: i386-stub.c m32r-stub.c m68k-stub.c sh-stub.c sparc-stub.c sparcl-stub.c sparclet-stub.c I'll post a separate RFC for the reversion changes and wait a few days for comments as usual. Thanks for catching this. Kevin From kevinb@cygnus.com Fri Sep 15 11:18:00 2000 From: Kevin Buettner <kevinb@cygnus.com> To: Stan Shebs <shebs@apple.com>, jtc@redback.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 11:18:00 -0000 Message-id: <1000915181800.ZM5181@ocotillo.lan> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> <39C2649F.36BE8BBD@apple.com> <shebs@apple.com> X-SW-Source: 2000-09/msg00141.html Content-length: 895 On Sep 15, 11:04am, Stan Shebs wrote: > "J.T. Conklin" wrote: > > > Should we consider not protoizing the *-stub.c files? While these are > > distributed with GDB, they are code that is going to be hacked to bits > > as they are integrated into a remote target. While user is probably > > using gcc, it may be reasonable to be as conservative we can when it > > comes to these files... > > It's a pretty safe bet that all m32r compilers are ISO! I thought > about the stub code standard a while back, and concluded that since > the stubs are effectively example code, they at least ought to be > *good* examples. In fact, they're probably the most-looked-at sources > in the whole GDB tree, so they should be exemplars of our recommended > coding practices (suitably adjusted for the embedded case of course). Okay, I'm confused. Stan, are you suggesting that I leave the prototypes in? From jtc@redback.com Fri Sep 15 11:32:00 2000 From: jtc@redback.com (J.T. Conklin) To: Kevin Buettner <kevinb@cygnus.com> Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 11:32:00 -0000 Message-id: <5mwvgdy09h.fsf@jtc.redback.com> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> <1000915181249.ZM5172@ocotillo.lan> X-SW-Source: 2000-09/msg00142.html Content-length: 1655 >>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes: >> Should we consider not protoizing the *-stub.c files? While these are >> distributed with GDB, they are code that is going to be hacked to bits >> as they are integrated into a remote target. While user is probably >> using gcc, it may be reasonable to be as conservative we can when it >> comes to these files... Kevin> You're right. I think that Andrew (and perhaps others) warned Kevin> me about this too. Kevin> I hereby withdraw the m32r-stub.c portion of the patch. Kevin> Also, I will need to revert many of the changes that occurred in my Kevin> changes of 2000-07-29. Specifically, I'll need to revert the changes Kevin> that were made to the following files: Kevin> i386-stub.c Kevin> m32r-stub.c Kevin> m68k-stub.c Kevin> sh-stub.c Kevin> sparc-stub.c Kevin> sparcl-stub.c Kevin> sparclet-stub.c And I should have cought this and commented then. Sorry 'bout that. I've been overwhelmed as of late. Kevin> I'll post a separate RFC for the reversion changes and wait a few days Kevin> for comments as usual. Don't jump the gun. As Stan says, there are reasons that we might want to protoize the files. Lets make sure the pros and cons of stub protoization are understood, and then make a decision whether to keep the work you already have completed or to revert it. I'm pretty ambivilent about it myself. In my experience, beyond toy programs, stubs get hacked quite extensively to integrate them into the target system. Removing protototypes would be the least of the user's worries. --jtc -- J.T. Conklin RedBack Networks From shebs@apple.com Fri Sep 15 11:50:00 2000 From: Stan Shebs <shebs@apple.com> To: jtc@redback.com Cc: Kevin Buettner <kevinb@cygnus.com>, gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 11:50:00 -0000 Message-id: <39C26F82.288A4D27@apple.com> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> <1000915181249.ZM5172@ocotillo.lan> <5mwvgdy09h.fsf@jtc.redback.com> X-SW-Source: 2000-09/msg00144.html Content-length: 647 "J.T. Conklin" wrote: > > I'm pretty ambivilent about it myself. In my experience, beyond toy > programs, stubs get hacked quite extensively to integrate them into > the target system. Removing protototypes would be the least of the > user's worries. So can you imagine any possible circumstance in which having a prototyped and/or ISO stub would be a problem for an actual embedded system developer today? The only example I can synthesize involves somebody that can only use GDB with one of Sun's old compilers adapted for embedded use, but not GCC. That's pretty farfetched though, and I've never heard of an actual case like that. Stan From kevinb@cygnus.com Fri Sep 15 11:50:00 2000 From: Kevin Buettner <kevinb@cygnus.com> To: jtc@redback.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 11:50:00 -0000 Message-id: <1000915185022.ZM5331@ocotillo.lan> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> <1000915181249.ZM5172@ocotillo.lan> <5mwvgdy09h.fsf@jtc.redback.com> X-SW-Source: 2000-09/msg00143.html Content-length: 17953 On Sep 15, 11:32am, J.T. Conklin wrote: > Don't jump the gun. As Stan says, there are reasons that we might > want to protoize the files. Lets make sure the pros and cons of stub > protoization are understood, and then make a decision whether to keep > the work you already have completed or to revert it. Okay. However, just so that we have some patches to look at while we conduct our deliberations, I've appended a patch below which shows what the reversion patch would look like. > I'm pretty ambivilent about it myself. In my experience, beyond toy > programs, stubs get hacked quite extensively to integrate them into > the target system. Removing protototypes would be the least of the > user's worries. I see. I knew that the stubs were examples, but I was also under the impression that the examples that we include would (or did at one time) compile on some real system. Anyway, here's the patch. I won't commit this one unless we all decide that it's a good idea to do so. * i386-stub.c, m32r-stub.c, m68k-stub.c, sh-stub.c, sparc-stub.c, sparcl-stub.c, sparclet-stub.c: Revert protoization changes of 2000-07-29. Index: i386-stub.c =================================================================== RCS file: /cvs/src/src/gdb/i386-stub.c,v retrieving revision 1.2 diff -u -r1.2 i386-stub.c --- i386-stub.c 2000/07/30 01:48:25 1.2 +++ i386-stub.c 2000/09/15 18:37:53 @@ -449,7 +449,7 @@ /* scan for the sequence $<data>#<checksum> */ unsigned char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -562,7 +562,7 @@ static volatile int mem_err = 0; void -set_mem_err (void) +set_mem_err () { mem_err = 1; } @@ -572,13 +572,16 @@ to mem_fault, they won't get restored, so there better not be any saved). */ int -get_char (char *addr) +get_char (addr) + char *addr; { return *addr; } void -set_char (char *addr, int val) +set_char (addr, val) + char *addr; + int val; { *addr = val; } Index: m32r-stub.c =================================================================== RCS file: /cvs/src/src/gdb/m32r-stub.c,v retrieving revision 1.3 diff -u -r1.3 m32r-stub.c --- m32r-stub.c 2000/07/30 01:48:26 1.3 +++ m32r-stub.c 2000/09/15 18:37:54 @@ -535,7 +535,10 @@ static unsigned long crc32_table[256] = {0, 0}; static unsigned long -crc32 (unsigned char *buf, int len, unsigned long crc) +crc32 (buf, len, crc) + unsigned char *buf; + int len; + unsigned long crc; { if (! crc32_table[1]) { @@ -560,7 +563,8 @@ } static int -hex (unsigned char ch) +hex(ch) + unsigned char ch; { if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); if ((ch >= '0') && (ch <= '9')) return (ch-'0'); @@ -571,7 +575,7 @@ /* scan for the sequence $<data>#<checksum> */ unsigned char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -647,7 +651,8 @@ /* send the packet in buffer. */ static void -putpacket (unsigned char *buffer) +putpacket(buffer) + unsigned char *buffer; { unsigned char checksum; int count; @@ -675,7 +680,7 @@ static void (*volatile mem_fault_routine)() = 0; static void -set_mem_err (void) +set_mem_err () { mem_err = 1; } @@ -686,7 +691,8 @@ whether there's anything connected to the expansion bus. */ static int -mem_safe (unsigned char *addr) +mem_safe (addr) + unsigned char *addr; { #define BAD_RANGE_ONE_START ((unsigned char *) 0x600000) #define BAD_RANGE_ONE_END ((unsigned char *) 0xa00000) @@ -704,7 +710,8 @@ to mem_fault, they won't get restored, so there better not be any saved). */ static int -get_char (unsigned char *addr) +get_char (addr) + unsigned char *addr; { #if 1 if (mem_fault_routine && !mem_safe(addr)) @@ -717,7 +724,9 @@ } static void -set_char (unsigned char *addr, unsigned char val) +set_char (addr, val) + unsigned char *addr; + unsigned char val; { #if 1 if (mem_fault_routine && !mem_safe (addr)) @@ -735,7 +744,11 @@ a fault; if zero treat a fault like any other fault in the stub. */ static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) +mem2hex(mem, buf, count, may_fault) + unsigned char* mem; + unsigned char* buf; + int count; + int may_fault; { int i; unsigned char ch; @@ -759,7 +772,11 @@ Return a pointer to the character AFTER the last byte written. */ static unsigned char* -hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +hex2mem(buf, mem, count, may_fault) + unsigned char* buf; + unsigned char* mem; + int count; + int may_fault; { int i; unsigned char ch; @@ -784,7 +801,11 @@ COUNT is the total number of bytes to write into memory. */ static unsigned char * -bin2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +bin2mem (buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; { int i; unsigned char ch; @@ -826,7 +847,8 @@ translate this number into a unix compatible signal value */ static int -computeSignal (int exceptionVector) +computeSignal(exceptionVector) + int exceptionVector; { int sigval; switch (exceptionVector) { @@ -858,7 +880,9 @@ /* RETURN NUMBER OF CHARS PROCESSED */ /**********************************************/ static int -hexToInt (unsigned char **ptr, int *intValue) +hexToInt(ptr, intValue) + unsigned char **ptr; + int *intValue; { int numChars = 0; int hexValue; @@ -904,7 +928,8 @@ */ static int -isShortBranch (unsigned char *instr) +isShortBranch(instr) + unsigned char *instr; { unsigned char instr0 = instr[0] & 0x7F; /* mask off high bit */ @@ -923,7 +948,8 @@ } static int -isLongBranch (unsigned char *instr) +isLongBranch(instr) + unsigned char *instr; { if (instr[0] == 0xFC || instr[0] == 0xFD || /* BRA, BNC, BL, BC */ instr[0] == 0xFE || instr[0] == 0xFF) /* 24 bit relative */ @@ -949,7 +975,8 @@ ((((int) addr & 2) || (((unsigned char *) addr)[0] & 0x80) == 0) ? 2 : 4) static int -isBranch (unsigned char *instr) +isBranch(instr) + unsigned char *instr; { if (INSTRUCTION_SIZE(instr) == 2) return isShortBranch(instr); @@ -958,7 +985,8 @@ } static int -willBranch (unsigned char *instr, int branchCode) +willBranch(instr, branchCode) + unsigned char *instr; { switch (branchCode) { @@ -1013,7 +1041,8 @@ } static int -branchDestination (unsigned char *instr, int branchCode) +branchDestination(instr, branchCode) + unsigned char *instr; { switch (branchCode) { default: @@ -1044,7 +1073,9 @@ } static void -branchSideEffects (unsigned char *instr, int branchCode) +branchSideEffects(instr, branchCode) + unsigned char *instr; + int branchCode; { switch (branchCode) { @@ -1154,7 +1185,7 @@ just "continue continuing". */ static int -finish_from_step (void) +finish_from_step() { if (stepping.stepping) /* anything to do? */ { @@ -1245,7 +1276,7 @@ but doing stash_registers in C isn't straightforward. */ static void -cleanup_stash (void) +cleanup_stash () { psw = (struct PSWreg *) ®isters[PSW]; /* fields of PSW register */ psw->sm = psw->bsm; /* fix up pre-trap values of psw fields */ @@ -1313,7 +1344,8 @@ NUM is the trap/exception number. */ static void -process_exception (int num) +process_exception (num) + int num; { cleanup_stash (); asm volatile (" @@ -1520,7 +1552,7 @@ /* this function is used to set up exception handlers for tracing and breakpoints */ void -set_debug_traps (void) +set_debug_traps() { /* extern void remcomHandler(); */ int i; @@ -1561,7 +1593,7 @@ #define BREAKPOINT() asm volatile (" trap #2"); void -breakpoint (void) +breakpoint() { if (initialized) BREAKPOINT(); @@ -1580,7 +1612,8 @@ Returns: the char */ static int -gdb_putchar (int ch) +gdb_putchar(ch) + int ch; { char buf[4]; @@ -1597,7 +1630,9 @@ Returns: number of bytes written */ static int -gdb_write (char *data, int len) +gdb_write(data, len) + char *data; + int len; { char *buf, *cpy; int i; @@ -1625,7 +1660,8 @@ Returns: the length of the string */ static int -gdb_puts (char *str) +gdb_puts(str) + char *str; { return gdb_write(str, strlen(str)); } @@ -1636,7 +1672,9 @@ will cause the optional second string to be inserted. */ static void -gdb_error (char *format, char *parm) +gdb_error(format, parm) + char * format; + char * parm; { char buf[400], *cpy; int len; Index: m68k-stub.c =================================================================== RCS file: /cvs/src/src/gdb/m68k-stub.c,v retrieving revision 1.2 diff -u -r1.2 m68k-stub.c --- m68k-stub.c 2000/07/30 01:48:26 1.2 +++ m68k-stub.c 2000/09/15 18:37:56 @@ -528,7 +528,7 @@ /* scan for the sequence $<data>#<checksum> */ unsigned char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -966,7 +966,7 @@ void -initializeRemcomErrorFrame (void) +initializeRemcomErrorFrame() { lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE-1]) - 1; lastFrame->previous = lastFrame; Index: sh-stub.c =================================================================== RCS file: /cvs/src/src/gdb/sh-stub.c,v retrieving revision 1.2 diff -u -r1.2 sh-stub.c --- sh-stub.c 2000/07/30 01:48:27 1.2 +++ sh-stub.c 2000/09/15 18:37:57 @@ -383,7 +383,7 @@ /* scan for the sequence $<data>#<checksum> */ char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -802,7 +802,7 @@ } void -gdb_mode (void) +gdb_mode() { ingdbmode = GDBCOOKIE; breakpoint(); @@ -1324,7 +1324,7 @@ static void -exceptions (void) +exceptions() { code_for_catch_exception (CPU_BUS_ERROR_VEC); code_for_catch_exception (DMA_BUS_ERROR_VEC); @@ -1492,12 +1492,12 @@ void handleError (char theSSR); void -nop (void) +nop () { } void -init_serial (void) +init_serial() { int i; @@ -1556,7 +1556,7 @@ } int -putDebugCharReady (void) +putDebugCharReady() { return (SSR1 & SCI_TDRE); } Index: sparc-stub.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-stub.c,v retrieving revision 1.2 diff -u -r1.2 sparc-stub.c --- sparc-stub.c 2000/07/30 01:48:27 1.2 +++ sparc-stub.c 2000/09/15 18:37:57 @@ -269,7 +269,8 @@ /* Convert ch from a hex digit to an int */ static int -hex (unsigned char ch) +hex(ch) + unsigned char ch; { if (ch >= 'a' && ch <= 'f') return ch-'a'+10; @@ -286,7 +287,7 @@ /* scan for the sequence $<data>#<checksum> */ unsigned char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -352,7 +353,8 @@ /* send the packet in buffer. */ static void -putpacket (unsigned char *buffer) +putpacket(buffer) + unsigned char *buffer; { unsigned char checksum; int count; @@ -392,7 +394,11 @@ */ static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; { unsigned char ch; @@ -418,7 +424,11 @@ * return a pointer to the character AFTER the last byte written */ static char * -hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; { int i; unsigned char ch; @@ -463,7 +473,7 @@ /* Set up exception handlers for tracing and breakpoints */ void -set_debug_traps (void) +set_debug_traps() { struct hard_trap_info *ht; @@ -490,7 +500,8 @@ "); static void -set_mem_fault_trap (int enable) +set_mem_fault_trap(enable) + int enable; { extern void fltr_set_mem_err(); mem_err = 0; @@ -504,7 +515,8 @@ /* Convert the SPARC hardware trap type code to a unix signal number. */ static int -computeSignal (int tt) +computeSignal(tt) + int tt; { struct hard_trap_info *ht; @@ -552,7 +564,8 @@ extern void breakinst(); static void -handle_exception (unsigned long *registers) +handle_exception (registers) + unsigned long *registers; { int tt; /* Trap type */ int sigval; @@ -766,7 +779,7 @@ the debugger. */ void -breakpoint (void) +breakpoint() { if (!initialized) return; Index: sparcl-stub.c =================================================================== RCS file: /cvs/src/src/gdb/sparcl-stub.c,v retrieving revision 1.3 diff -u -r1.3 sparcl-stub.c --- sparcl-stub.c 2000/07/30 01:48:27 1.3 +++ sparcl-stub.c 2000/09/15 18:37:58 @@ -366,7 +366,8 @@ /* Convert ch from a hex digit to an int */ static int -hex (unsigned char ch) +hex(ch) + unsigned char ch; { if (ch >= 'a' && ch <= 'f') return ch-'a'+10; @@ -383,7 +384,7 @@ /* scan for the sequence $<data>#<checksum> */ unsigned char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -449,7 +450,8 @@ /* send the packet in buffer. */ static void -putpacket (unsigned char *buffer) +putpacket(buffer) + unsigned char *buffer; { unsigned char checksum; int count; @@ -489,7 +491,11 @@ */ static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; { unsigned char ch; @@ -515,7 +521,11 @@ * return a pointer to the character AFTER the last byte written */ static char * -hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; { int i; unsigned char ch; @@ -566,7 +576,7 @@ /* Set up exception handlers for tracing and breakpoints */ void -set_debug_traps (void) +set_debug_traps() { struct hard_trap_info *ht; @@ -598,7 +608,8 @@ "); static void -set_mem_fault_trap (int enable) +set_mem_fault_trap(enable) + int enable; { extern void fltr_set_mem_err(); mem_err = 0; @@ -621,7 +632,7 @@ "); static void -get_in_break_mode (void) +get_in_break_mode() { extern void dummy_hw_breakpoint(); @@ -635,7 +646,8 @@ /* Convert the SPARC hardware trap type code to a unix signal number. */ static int -computeSignal (int tt) +computeSignal(tt) + int tt; { struct hard_trap_info *ht; @@ -681,7 +693,8 @@ */ static void -handle_exception (unsigned long *registers) +handle_exception (registers) + unsigned long *registers; { int tt; /* Trap type */ int sigval; @@ -934,7 +947,7 @@ the debugger. */ void -breakpoint (void) +breakpoint() { if (!initialized) return; Index: sparclet-stub.c =================================================================== RCS file: /cvs/src/src/gdb/sparclet-stub.c,v retrieving revision 1.3 diff -u -r1.3 sparclet-stub.c --- sparclet-stub.c 2000/07/30 01:48:27 1.3 +++ sparclet-stub.c 2000/09/15 18:37:58 @@ -435,7 +435,8 @@ /* Convert ch from a hex digit to an int */ static int -hex (unsigned char ch) +hex(ch) + unsigned char ch; { if (ch >= 'a' && ch <= 'f') return ch-'a'+10; @@ -452,7 +453,7 @@ /* scan for the sequence $<data>#<checksum> */ unsigned char * -getpacket (void) +getpacket () { unsigned char *buffer = &remcomInBuffer[0]; unsigned char checksum; @@ -518,7 +519,8 @@ /* send the packet in buffer. */ static void -putpacket (unsigned char *buffer) +putpacket(buffer) + unsigned char *buffer; { unsigned char checksum; int count; @@ -558,7 +560,11 @@ */ static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; { unsigned char ch; @@ -584,7 +590,11 @@ * return a pointer to the character AFTER the last byte written */ static char * -hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; { int i; unsigned char ch; @@ -630,7 +640,7 @@ /* Set up exception handlers for tracing and breakpoints */ void -set_debug_traps (void) +set_debug_traps() { struct hard_trap_info *ht; @@ -657,7 +667,8 @@ "); static void -set_mem_fault_trap (int enable) +set_mem_fault_trap(enable) + int enable; { extern void fltr_set_mem_err(); mem_err = 0; @@ -680,7 +691,8 @@ "); static void -set_hw_breakpoint_trap (int enable) +set_hw_breakpoint_trap(enable) + int enable; { extern void dummy_hw_breakpoint(); @@ -691,7 +703,7 @@ } static void -get_in_break_mode (void) +get_in_break_mode() { #if 0 int x; @@ -715,7 +727,8 @@ /* Convert the SPARC hardware trap type code to a unix signal number. */ static int -computeSignal (int tt) +computeSignal(tt) + int tt; { struct hard_trap_info *ht; @@ -761,7 +774,8 @@ */ static void -handle_exception (unsigned long *registers) +handle_exception (registers) + unsigned long *registers; { int tt; /* Trap type */ int sigval; @@ -1035,7 +1049,7 @@ the debugger. */ void -breakpoint (void) +breakpoint() { if (!initialized) return; @@ -1047,7 +1061,7 @@ } static void -hw_breakpoint (void) +hw_breakpoint() { asm(" ta 127 ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <1000915181249.ZM5172@ocotillo.lan>]
[parent not found: <5mwvgdy09h.fsf@jtc.redback.com>]
[parent not found: <1000915185022.ZM5331@ocotillo.lan>]
* Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c [not found] ` <1000915185022.ZM5331@ocotillo.lan> @ 2000-09-15 12:07 ` J.T. Conklin 0 siblings, 0 replies; 2+ messages in thread From: J.T. Conklin @ 2000-09-15 12:07 UTC (permalink / raw) To: Kevin Buettner; +Cc: gdb-patches >>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes: Kevin> Okay. However, just so that we have some patches to look at while Kevin> we conduct our deliberations, I've appended a patch below which Kevin> shows what the reversion patch would look like. Thanks. At the very least, that make sure we're all on the same page. >> I'm pretty ambivilent about it myself. In my experience, beyond toy >> programs, stubs get hacked quite extensively to integrate them into >> the target system. Removing protototypes would be the least of the >> user's worries. Kevin> I see. I knew that the stubs were examples, but I was also Kevin> under the impression that the examples that we include would Kevin> (or did at one time) compile on some real system. I'm pretty sure the stubs build and are usable as is. I recently built i386-stub.c for some tests. What I was trying to say is that when a stub is integrated into a system, it may be modified to fit the conventions already being used. For example, if a system has a constant exception handler, the stubs code that installs exception vectors is probably going to be ripped out and the appropriate entries in the table will be made to point to the stub. If the target system's exception stack frame saves registers in a different order, the stub may be modified to fetch/store registers in the target's order instead of imposing the GDB order on the target, etc. There are a lot of implementation details that might necessitate hacking the stub. --jtc -- J.T. Conklin RedBack Networks From jtc@redback.com Fri Sep 15 12:13:00 2000 From: jtc@redback.com (J.T. Conklin) To: Stan Shebs <shebs@apple.com> Cc: Kevin Buettner <kevinb@cygnus.com>, gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Fri, 15 Sep 2000 12:13:00 -0000 Message-id: <5mem2lxycm.fsf@jtc.redback.com> References: <1000915073306.ZM4195@ocotillo.lan> <5mk8cdzgri.fsf@jtc.redback.com> <1000915181249.ZM5172@ocotillo.lan> <5mwvgdy09h.fsf@jtc.redback.com> <39C26F82.288A4D27@apple.com> X-SW-Source: 2000-09/msg00146.html Content-length: 1213 >>>>> "Stan" == Stan Shebs <shebs@apple.com> writes: Stan> So can you imagine any possible circumstance in which having a Stan> prototyped and/or ISO stub would be a problem for an actual Stan> embedded system developer today? The only example I can Stan> synthesize involves somebody that can only use GDB with one of Stan> Sun's old compilers adapted for embedded use, but not GCC. Stan> That's pretty farfetched though, and I've never heard of an Stan> actual case like that. I have :-(. When I went to Cisco, the project I worked on had once used BSD/OS's native toolchain to generate the image for the target system. Then they switched to Plan 9 and used the Plan 9 native tools to generate the image. While both BSD/OS (gnu-based) toolchain and the Plan 9 tools understood prototypes; I mention this just to confirm that there are folks out there that do *really wierd things*. I have to agree, it's hard to imagine a situation where a prototyped stub would be problem. As I mentioned in earlier messages, even if a developer worked in an environment without prototypes, fixing that is nothing compared to integrating it into his/her target system. --jtc -- J.T. Conklin RedBack Networks From fnasser@cygnus.com Fri Sep 15 13:59:00 2000 From: Fernando Nasser <fnasser@cygnus.com> To: gdb-patches@sourceware.cygnus.com Subject: RFA: Patch to remote.c - Fix to recovery from lost ACK Date: Fri, 15 Sep 2000 13:59:00 -0000 Message-id: <39C28D98.D067DF65@cygnus.com> X-SW-Source: 2000-09/msg00147.html Content-length: 2423 Andrew and me were looking at this code and we saw something that did not looked right. I created this patch that I think straights things up. 2000-09-15 Fernando Nasser <fnasser@totem.to.cygnus.com> * remote.c (putpkt_binary): Call read_frame, not getpkt. Log message. (read_frame): Do not call error() on communication error when reading checksum, but return failure instead and log message. -- Fernando Nasser Red Hat - Toronto E-Mail: fnasser@cygnus.com Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.23 diff -c -p -r1.23 remote.c *** remote.c 2000/09/01 00:12:10 1.23 --- remote.c 2000/09/15 20:48:13 *************** putpkt_binary (char *buf, int cnt) *** 3796,3804 **** break; /* Retransmit buffer */ case '$': { /* It's probably an old response, and we're out of sync. Just gobble up the packet and ignore it. */ ! getpkt (junkbuf, sizeof_junkbuf, 0); continue; /* Now, go look for + */ } default: --- 3796,3806 ---- break; /* Retransmit buffer */ case '$': { + if (remote_debug) + fprintf_unfiltered (gdb_stdlog, "Packet instead of Ack, ignoring it\n"); /* It's probably an old response, and we're out of sync. Just gobble up the packet and ignore it. */ ! read_frame (junkbuf, sizeof_junkbuf); continue; /* Now, go look for + */ } default: *************** read_frame (char *buf, *** 3887,3893 **** return -1; } else if (check_0 < 0 || check_1 < 0) ! error ("Communication error in checksum"); pktcsum = (fromhex (check_0) << 4) | fromhex (check_1); if (csum == pktcsum) --- 3889,3899 ---- return -1; } else if (check_0 < 0 || check_1 < 0) ! { ! if (remote_debug) ! fputs_filtered ("Communication error in checksum\n", gdb_stdlog); ! return -1; ! } pktcsum = (fromhex (check_0) << 4) | fromhex (check_1); if (csum == pktcsum) From Peter.Schauer@regent.e-technik.tu-muenchen.de Sun Sep 17 04:03:00 2000 From: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de> To: gdb-patches@sourceware.cygnus.com Subject: RFD: Testsuite cases for inferior function calls Date: Sun, 17 Sep 2000 04:03:00 -0000 Message-id: <200009171103.NAA24702@reisser.regent.e-technik.tu-muenchen.de> X-SW-Source: 2000-09/msg00148.html Content-length: 14787 Fernando Nasser wrote: > Probably because there is no testcase for this... (hint hint hint) I have spent some time to come up with testsuite cases for this, and fixing all the GDB bugs that turned up in the targets I have access to (Solaris sparc, Solaris x86, AIX 4.3, Linux x86). I suspect that many more targets might fail on these testcases, so before I go to all the trouble for submitting proper RFAs for the changes (adding more comments and ChangeLog entries), is there any chance that the new testsuite cases get accepted ? I'd also be interested in the test results on other targets for the new testcases. Here are my current diffs versus CVS GDB from Sep 15: *** ./testsuite/gdb.base/callfuncs.c.orig Mon Jun 28 18:02:51 1999 --- ./testsuite/gdb.base/callfuncs.c Fri Sep 15 21:36:51 2000 *************** *** 172,192 **** (i5 == 5) && (i6 == 6) && (i7 == 7) && (i8 == 8) && (i9 == 9); } - - /* Gotta have a main to be able to generate a linked, runnable - executable, and also provide a useful place to set a breakpoint. */ - extern void * malloc() ; - int main () - { - #ifdef usestubs - set_debug_traps(); - breakpoint(); - #endif - malloc(1); - t_structs_c(struct_val1); - return 0 ; - } - /* Functions that expect specific values to be passed and return either 0 or 1, depending upon whether the values were passed incorrectly or correctly, respectively. */ --- 172,177 ---- *************** *** 356,359 **** --- 341,360 ---- #endif { return ((*func_arg1)(a, b)); + } + + + /* Gotta have a main to be able to generate a linked, runnable + executable, and also provide a useful place to set a breakpoint. */ + extern void * malloc() ; + int main () + { + #ifdef usestubs + set_debug_traps(); + breakpoint(); + #endif + malloc(1); + t_double_values(double_val1, double_val2); + t_structs_c(struct_val1); + return 0 ; } *** ./testsuite/gdb.base/callfuncs.exp.orig Thu Jan 6 04:06:51 2000 --- ./testsuite/gdb.base/callfuncs.exp Fri Sep 15 21:36:51 2000 *************** *** 237,242 **** --- 237,260 ---- "call inferior func with struct - returns char *" } + # Procedure to get current content of all registers. + global all_registers_content + set all_registers_content "" + proc do_get_all_registers { } { + global gdb_prompt + global expect_out + global all_registers_content + + set all_registers_content "" + send_gdb "info all-registers\n" + gdb_expect { + -re "info all-registers\r\n(.*)$gdb_prompt $" { + set all_registers_content $expect_out(1,string) + } + default {} + } + } + # Start with a fresh gdb. gdb_exit *************** *** 271,277 **** --- 289,368 ---- } } + # Make sure that malloc gets called and that the floating point unit + # is initialized via a call to t_double_values. + gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*" gdb_test "next" "t_structs_c\\(struct_val1\\);.*" + + # Save all register contents. + do_get_all_registers + set old_reg_content $all_registers_content + + # Perform function calls. do_function_calls + # Check if all registers still have the same value. + do_get_all_registers + set new_reg_content $all_registers_content + if [string match $old_reg_content $new_reg_content] then { + pass "gdb function calls preserve register contents" + } else { + set old_reg_content $all_registers_content + fail "gdb function calls preserve register contents" + } + + # Set breakpoint at a function we will call from gdb. + gdb_breakpoint add + + # Call function (causing a breakpoint hit in the call dummy) and do a continue, + # make sure we are back at main and still have the same register contents. + gdb_test "print add(4,5)" "The program being debugged stopped while.*" "" + gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint" + if ![gdb_test "bt 2" \ + "#0 main.*" \ + "bt after continuing from call dummy breakpoint"] then { + do_get_all_registers + set new_reg_content $all_registers_content + if [string match $old_reg_content $new_reg_content] then { + pass "continue after stop in call dummy preserves register contents" + } else { + fail "continue after stop in call dummy preserves register contents" + } + } + + # Call function (causing a breakpoint hit in the call dummy) and do a finish, + # make sure we are back at main and still have the same register contents. + gdb_test "print add(4,5)" "The program being debugged stopped while.*" "" + gdb_test "finish" \ + "Value returned is.* = 9" \ + "finish from call dummy breakpoint returns correct value" + if ![gdb_test "bt 2" \ + "#0 main.*" \ + "bt after finishing from call dummy breakpoint"] then { + do_get_all_registers + set new_reg_content $all_registers_content + if [string match $old_reg_content $new_reg_content] then { + pass "finish after stop in call dummy preserves register contents" + } else { + fail "finish after stop in call dummy preserves register contents" + } + } + + # Call function (causing a breakpoint hit in the call dummy) and do a return + # with a value, make sure we are back at main with the same register contents. + gdb_test "print add(4,5)" "The program being debugged stopped while.*" "" + if ![gdb_test "return 7" \ + "#0 main.*" \ + "back at main after return from call dummy breakpoint" \ + "Make add return now. .y or n.*" \ + "y"] then { + do_get_all_registers + set new_reg_content $all_registers_content + if [string match $old_reg_content $new_reg_content] then { + pass "return after stop in call dummy preserves register contents" + } else { + fail "return after stop in call dummy preserves register contents" + } + } + return 0 *** ./config/i386/nm-linux.h.orig Fri Sep 15 21:27:38 2000 --- ./config/i386/nm-linux.h Sun Sep 17 12:24:45 2000 *************** *** 65,76 **** /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ #define FETCH_INFERIOR_REGISTERS ! /* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we fall back on the code `infptrace.c' (well a copy of that code in `i386-linux-nat.c' for now) and we can access only the general-purpose registers in that way. */ ! #define CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS) ! #define CANNOT_STORE_REGISTER(regno) CANNOT_FETCH_REGISTER (regno) /* Override child_resume in `infptrace.c'. */ #define CHILD_RESUME --- 65,78 ---- /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ #define FETCH_INFERIOR_REGISTERS ! /* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we might fall back on the code `infptrace.c' (well a copy of that code in `i386-linux-nat.c' for now) and we can access only the general-purpose registers in that way. */ ! extern int cannot_fetch_register (int regno); ! extern int cannot_store_register (int regno); ! #define CANNOT_FETCH_REGISTER(regno) cannot_store_register (regno) ! #define CANNOT_STORE_REGISTER(regno) cannot_fetch_register (regno) /* Override child_resume in `infptrace.c'. */ #define CHILD_RESUME *** ./i386-linux-nat.c.orig Fri Sep 15 21:27:11 2000 --- ./i386-linux-nat.c Sun Sep 17 12:20:48 2000 *************** *** 133,141 **** #endif /* Registers we shouldn't try to fetch. */ ! #if !defined (CANNOT_FETCH_REGISTER) ! #define CANNOT_FETCH_REGISTER(regno) 0 ! #endif /* Fetch one register. */ --- 133,139 ---- #endif /* Registers we shouldn't try to fetch. */ ! #define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS) /* Fetch one register. */ *************** *** 150,156 **** char buf[MAX_REGISTER_RAW_SIZE]; int tid; ! if (CANNOT_FETCH_REGISTER (regno)) { memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ supply_register (regno, buf); --- 148,154 ---- char buf[MAX_REGISTER_RAW_SIZE]; int tid; ! if (OLD_CANNOT_FETCH_REGISTER (regno)) { memset (buf, '\0', REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ supply_register (regno, buf); *************** *** 201,209 **** } /* Registers we shouldn't try to store. */ ! #if !defined (CANNOT_STORE_REGISTER) ! #define CANNOT_STORE_REGISTER(regno) 0 ! #endif /* Store one register. */ --- 199,205 ---- } /* Registers we shouldn't try to store. */ ! #define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= NUM_GREGS) /* Store one register. */ *************** *** 217,223 **** unsigned int offset; /* Offset of registers within the u area. */ int tid; ! if (CANNOT_STORE_REGISTER (regno)) { return; } --- 213,219 ---- unsigned int offset; /* Offset of registers within the u area. */ int tid; ! if (OLD_CANNOT_STORE_REGISTER (regno)) { return; } *************** *** 513,518 **** --- 509,529 ---- /* Transferring arbitrary registers between GDB and inferior. */ + int + cannot_fetch_register (int regno) + { + if (! have_ptrace_getregs) + return OLD_CANNOT_FETCH_REGISTER (regno); + return 0; + } + int + cannot_store_register (int regno) + { + if (! have_ptrace_getregs) + return OLD_CANNOT_STORE_REGISTER (regno); + return 0; + } + /* Fetch register REGNO from the child process. If REGNO is -1, do this for all registers (including the floating point and SSE registers). */ *** ./rs6000-tdep.c.orig Sat Aug 5 11:37:42 2000 --- ./rs6000-tdep.c Fri Sep 15 21:36:51 2000 *************** *** 671,679 **** frames, etc. *************************************************************************/ - extern int stop_stack_dummy; - /* Pop the innermost frame, go back to the caller. */ static void --- 671,677 ---- *************** *** 687,693 **** pc = read_pc (); sp = FRAME_FP (frame); ! if (stop_stack_dummy) { generic_pop_dummy_frame (); flush_cached_frames (); --- 685,691 ---- pc = read_pc (); sp = FRAME_FP (frame); ! if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) { generic_pop_dummy_frame (); flush_cached_frames (); *************** *** 2140,2145 **** --- 2138,2144 ---- set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); + set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_push_return_address (gdbarch, ppc_push_return_address); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_coerce_float_to_double (gdbarch, rs6000_coerce_float_to_double); *** ./sparc-tdep.c.orig Fri Sep 15 21:27:31 2000 --- ./sparc-tdep.c Fri Sep 15 21:36:51 2000 *************** *** 2138,2148 **** /* Comply with strange Sun cc calling convention for struct-returning functions. */ ! if (!using_gcc ! && (TYPE_CODE (value_type) == TYPE_CODE_STRUCT ! || TYPE_CODE (value_type) == TYPE_CODE_UNION)) ! store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4, ! TYPE_LENGTH (value_type) & 0x1fff); if (!(GDB_TARGET_IS_SPARC64)) { --- 2138,2152 ---- /* Comply with strange Sun cc calling convention for struct-returning functions. */ ! if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT ! || TYPE_CODE (value_type) == TYPE_CODE_UNION) ! { ! store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4, ! TYPE_LENGTH (value_type) & 0x1fff); ! set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 0x30); ! } ! else ! set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 0x2c); if (!(GDB_TARGET_IS_SPARC64)) { *************** *** 2961,2971 **** set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_max_register_raw_size (gdbarch, 8); set_gdbarch_max_register_virtual_size (gdbarch, 8); - #ifdef DO_CALL_DUMMY_ON_STACK - set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack); - #else - set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point); - #endif set_gdbarch_pop_frame (gdbarch, sparc_pop_frame); set_gdbarch_push_return_address (gdbarch, sparc_push_return_address); set_gdbarch_push_dummy_frame (gdbarch, sparc_push_dummy_frame); --- 2965,2970 ---- *************** *** 2999,3004 **** --- 2998,3004 ---- /* 32-bit machine types: */ #ifdef SPARC32_CALL_DUMMY_ON_STACK + set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack); set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0x30); set_gdbarch_call_dummy_length (gdbarch, 0x38); *************** *** 3005,3010 **** --- 3005,3011 ---- set_gdbarch_call_dummy_location (gdbarch, ON_STACK); set_gdbarch_call_dummy_words (gdbarch, call_dummy_32); #else + set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point); set_gdbarch_call_dummy_address (gdbarch, entry_point_address); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); set_gdbarch_call_dummy_length (gdbarch, 0); *************** *** 3053,3058 **** --- 3054,3060 ---- default: /* Any new machine type is likely to be 64-bit. */ #ifdef SPARC64_CALL_DUMMY_ON_STACK + set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack); set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 8 * 4); set_gdbarch_call_dummy_length (gdbarch, 192); *************** *** 3060,3065 **** --- 3062,3068 ---- set_gdbarch_call_dummy_start_offset (gdbarch, 148); set_gdbarch_call_dummy_words (gdbarch, call_dummy_64); #else + set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point); set_gdbarch_call_dummy_address (gdbarch, entry_point_address); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); set_gdbarch_call_dummy_length (gdbarch, 0); *** ./stack.c.orig Sat Aug 5 11:37:49 2000 --- ./stack.c Fri Sep 15 21:36:51 2000 *************** *** 1892,1897 **** --- 1892,1903 ---- if (retval_exp) set_return_value (return_value); + /* If we are at the end of a call dummy now, pop the dummy frame too. */ + + if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (), + FRAME_FP (get_current_frame ()))) + POP_FRAME; + /* If interactive, print the frame that is now current. */ if (from_tty) -- Peter Schauer pes@regent.e-technik.tu-muenchen.de From kettenis@wins.uva.nl Sun Sep 17 14:09:00 2000 From: Mark Kettenis <kettenis@wins.uva.nl> To: Peter.Schauer@regent.e-technik.tu-muenchen.de Cc: gdb-patches@sourceware.cygnus.com Subject: Re: RFD: Testsuite cases for inferior function calls Date: Sun, 17 Sep 2000 14:09:00 -0000 Message-id: <200009172109.e8HL9YM00808@delius.kettenis.local> References: <200009171103.NAA24702@reisser.regent.e-technik.tu-muenchen.de> X-SW-Source: 2000-09/msg00149.html Content-length: 499 From: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de> Date: Sun, 17 Sep 2000 13:03:19 MET DST Fernando Nasser wrote: > Probably because there is no testcase for this... (hint hint hint) I have spent some time to come up with testsuite cases for this, and fixing all the GDB bugs that turned up in the targets I have access to (Solaris sparc, Solaris x86, AIX 4.3, Linux x86). The Linux/x86 changes look fine to me, so consider those to be approved :-). Mark From kevinb@cygnus.com Sun Sep 17 17:37:00 2000 From: Kevin Buettner <kevinb@cygnus.com> To: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c Date: Sun, 17 Sep 2000 17:37:00 -0000 Message-id: <1000918003730.ZM28153@ocotillo.lan> References: <1000915073306.ZM4195@ocotillo.lan> <kevinb@cygnus.com> X-SW-Source: 2000-09/msg00150.html Content-length: 268 On Sep 15, 12:33am, Kevin Buettner wrote: > * m32r-stub.c (prepare_to_step): Protoize. Withdrawn until we decide whether to protoize stubs or not... > * m88k-nat.c (fetch_inferior_registers): Protoize. > * m88k-tdep.c (m88k_skip_prologue): Protoize. Committed. From kevinb@cygnus.com Sun Sep 17 18:20:00 2000 From: Kevin Buettner <kevinb@cygnus.com> To: gdb-patches@sourceware.cygnus.com Subject: [PATCH] Enable new linux thread support for GNU/Linux/PPC gdb Date: Sun, 17 Sep 2000 18:20:00 -0000 Message-id: <1000918012003.ZM28247@ocotillo.lan> X-SW-Source: 2000-09/msg00151.html Content-length: 5300 I've committed the patches below. They enable, for GNU/Linux/PPC, the new Linux thread support that Mark Kettenis recently contributed. I also tried to enable thread support for Linux/IA-64 and Linux/ARM, but had problems with getting the latter to work. (On Linux/IA64, the simple threads test program didn't even run. I probably need to upgrade something...) * ppc-linux-nat.c (fill_gregset, fill_fpregset): New functions. * config/powerpc/linux.mh (NATDEPFILES): Remove linux-thread.o. Add proc-service.o, thread-db.o, and lin-lwp.o. (LOADLIBES): Define. * config/powerpc/nm-linux.h (ATTACH_DETACH, SVR4_SHARED_LIBS): Remove defines which are already present in ../nm-linux.h. (solib.h): Don't include this file; it's already included by ../nm-linux.h. (PREPARE_TO_PROCEED, GET_THREAD_SIGNALS, ATTACH_LWP): Define to use the following lin-lwp.c functions... (lin_lwp_prepare_to_proceed, lin_thread_get_thread_signals, lin_lwp_attach_lwp): Declare. Index: ppc-linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v retrieving revision 1.4 diff -u -p -r1.4 ppc-linux-nat.c --- ppc-linux-nat.c 2000/07/30 01:48:26 1.4 +++ ppc-linux-nat.c 2000/09/18 00:39:58 @@ -71,11 +71,56 @@ supply_gregset (gregset_t * gregsetp) } void +fill_gregset (gregset_t *gregsetp, int regno) +{ + int regi; + greg_t *regp = (greg_t *) gregsetp; + +#define COPY_REG(_idx_,_regi_) \ + if ((regno == -1) || regno == _regi_) \ + memcpy (regp + _idx_, ®isters[REGISTER_BYTE (_regi_)], \ + REGISTER_RAW_SIZE (_regi_)) + + for (regi = 0; regi < 32; regi++) + { + COPY_REG (regmap[regi], regi); + } + + for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++) + { + COPY_REG (regmap[regi], regi); + } +} + +void supply_fpregset (fpregset_t * fpregsetp) { int regi; for (regi = 0; regi < 32; regi++) { supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi)); + } +} + +/* Given a pointer to a floating point register set in /proc format + (fpregset_t *), update the register specified by REGNO from gdb's idea + of the current floating point register set. If REGNO is -1, update + them all. */ + +void +fill_fpregset (fpregset_t *fpregsetp, int regno) +{ + int regi; + char *to; + char *from; + + for (regi = 0; regi < 32; regi++) + { + if ((regno == -1) || (regno == FP0_REGNUM + regi)) + { + from = (char *) ®isters[REGISTER_BYTE (FP0_REGNUM + regi)]; + to = (char *) (*fpregsetp + regi); + memcpy (to, from, REGISTER_RAW_SIZE (FP0_REGNUM + regi)); + } } } Index: config/powerpc/linux.mh =================================================================== RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v retrieving revision 1.3 diff -u -p -r1.3 linux.mh --- config/powerpc/linux.mh 2000/06/12 06:09:05 1.3 +++ config/powerpc/linux.mh 2000/09/18 00:39:58 @@ -5,6 +5,9 @@ XDEPFILES= XM_CLIBS= NAT_FILE= nm-linux.h -NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o ppc-linux-nat.o linux-thread.o +NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \ +core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o + +LOADLIBES = -ldl -rdynamic GDBSERVER_DEPFILES= low-linux.o Index: config/powerpc/nm-linux.h =================================================================== RCS file: /cvs/src/src/gdb/config/powerpc/nm-linux.h,v retrieving revision 1.3 diff -u -p -r1.3 nm-linux.h --- config/powerpc/nm-linux.h 2000/05/28 01:12:37 1.3 +++ config/powerpc/nm-linux.h 2000/09/18 00:39:58 @@ -28,9 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridg #define KERNEL_U_SIZE kernel_u_size() extern int kernel_u_size (void); -/* Tell gdb that we can attach and detach other processes */ -#define ATTACH_DETACH - #define U_REGS_OFFSET 0 #define REGISTER_U_ADDR(addr, blockend, regno) \ @@ -39,26 +36,21 @@ extern int kernel_u_size (void); /* No <sys/reg.h> */ #define NO_SYS_REG_H - -#ifdef HAVE_LINK_H -#include "solib.h" /* Support for shared libraries. */ -#define SVR4_SHARED_LIBS -#endif - -/* Support for Linuxthreads. */ -#ifdef __STDC__ -struct objfile; -#endif +/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h + once we have converted all Linux targets to use the new threads + stuff (without the #undef of course). */ -extern void linuxthreads_new_objfile (struct objfile *objfile); -#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE) +extern int lin_lwp_prepare_to_proceed (void); +#undef PREPARE_TO_PROCEED +#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed () -extern char *linuxthreads_pid_to_str (int pid); -#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID) +extern void lin_lwp_attach_lwp (int pid, int verbose); +#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose)) -extern int linuxthreads_prepare_to_proceed (int step); -#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1) +#include <signal.h> +extern void lin_thread_get_thread_signals (sigset_t *mask); +#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask) #endif /* #ifndef NM_LINUX_H */ ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-09-15 12:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1000915073306.ZM4195@ocotillo.lan>
2000-09-15 10:50 ` [PATCH RFC] Protoize m32r-stub.c, m88k-nat.c, m88k-tdep.c J.T. Conklin
[not found] ` <1000915181249.ZM5172@ocotillo.lan>
[not found] ` <5mwvgdy09h.fsf@jtc.redback.com>
[not found] ` <1000915185022.ZM5331@ocotillo.lan>
2000-09-15 12:07 ` J.T. Conklin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox