From: Jim Kingdon Date: Wed, 14 Jul 1993 22:44:03 +0000 (+0000) Subject: Changes from Jeffrey Law: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ab786f460f3b377d20fd0b82575bcf5e2e03b8c;p=binutils-gdb.git Changes from Jeffrey Law: * printcmd.c (makeva_list): Use MAKEVA_EXTRA_INFO to define machine dependent fields in the makeva_list structure. (makeva_size): Allocate extra space to handle gaps made by alignment restrictions. * config/pa/xm-pa.h (MAKEVA_EXTRA_INFO): Define. (MAKEVA_START): Initialize arglist_address field. (MAKEVA_ARG): Always store arguments on natural alignment boundaries. Set arglist_address to the address right after the args. (MAKEVA_END): Simply return the value stored in arglist_address. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf3dc3df2c9..683164d0891 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +Wed Jul 14 17:37:03 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + Changes from Jeffrey Law: + * printcmd.c (makeva_list): Use MAKEVA_EXTRA_INFO to define + machine dependent fields in the makeva_list structure. + (makeva_size): Allocate extra space to handle gaps made by + alignment restrictions. + * xm-pa.h (MAKEVA_EXTRA_INFO): Define. + (MAKEVA_START): Initialize arglist_address field. + (MAKEVA_ARG): Always store arguments on natural alignment + boundaries. Set arglist_address to the address right after + the args. + (MAKEVA_END): Simply return the value stored in arglist_address. + Wed Jul 14 13:51:54 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * ch-valprint.c (chill_val_print, case TYPE_CODE_STRING): Print diff --git a/gdb/config/pa/xm-pa.h b/gdb/config/pa/xm-pa.h index 523baf1324b..831be591de5 100644 --- a/gdb/config/pa/xm-pa.h +++ b/gdb/config/pa/xm-pa.h @@ -1,21 +1,34 @@ /* Definitions for all PA machines. */ +#define MAKEVA_EXTRA_INFO int arglist_address; + #define MAKEVA_START(list) \ - list->argindex = list->nargs * list->max_arg_size; + list->argindex = list->nargs * list->max_arg_size; \ + list->arglist_address = 0; #define MAKEVA_ARG(list, argaddr, argsize) \ - if (argsize > 8) \ - /* Currently this never happens; printf_command only uses argsize */ \ - /* of sizeof (int), sizeof (double), or sizeof (long long). */ \ - error ("MAKEVA_ARG not fully written for hp-pa"); \ - memcpy (&list->arg_bytes[list->argindex - argsize], argaddr, argsize); \ - if (argsize <= 4) \ - list->argindex -= 4; \ - else if (argsize <= 8) \ - list->argindex -= 8; \ + { \ + int rounded_argsize; \ + if (argsize > 8) \ + /* Currently this never happens; printf_command only uses argsize */ \ + /* of sizeof (int), sizeof (double), or sizeof (long long). */ \ + error ("MAKEVA_ARG not fully written for hp-pa"); \ + if (argsize <= 4) \ + rounded_argsize = 4; \ + else if (argsize <= 8) \ + rounded_argsize = 8; \ + list->argindex -= rounded_argsize; \ + while ((int)(&list->arg_bytes[list->argindex]) % rounded_argsize) \ + list->argindex--; \ + /* arglist_address is used to store the address of the first arguent. */ \ + if (list->arglist_address == 0) \ + list->arglist_address = &list->arg_bytes[list->argindex] \ + + rounded_argsize; \ + memcpy (&list->arg_bytes[list->argindex], argaddr, argsize); \ + } /* The address of the arglist is the address right after the args - (which is what you'd expect). */ + (which is what you'd expect). This address is stored in the arglist_address + field. */ #define MAKEVA_END(list) \ - return (va_list) (list->arg_bytes \ - + list->nargs * list->max_arg_size) + return (va_list) list->arglist_address; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 48ced2aeb90..cfe2e9b11f6 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1623,6 +1623,11 @@ typedef struct { /* Current position in bytes. */ unsigned int argindex; +#ifdef MAKEVA_EXTRA_INFO + /* For host dependent information. */ + MAKEVA_EXTRA_INFO +#endif + char arg_bytes[1]; } makeva_list; @@ -1634,7 +1639,9 @@ makeva_size (nargs, max_arg_size) unsigned int nargs; unsigned int max_arg_size; { - return sizeof (makeva_list) + nargs * max_arg_size; + return sizeof (makeva_list) + nargs * max_arg_size + /* The PA might need up to this much for alignment. */ + + max_arg_size - 1; } /* Start working on LIST with NARGS arguments and whose largest