Changeset da79d0fd in mainline


Ignore:
Timestamp:
2005-05-13T20:51:40Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
244f284
Parents:
f2ffad4
Message:

Add %P and %p formatters to printf for printing pointers in maximum bit width.
Add %Q and %q formatters to printf for printing 64-bit integers.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/print.h

    rf2ffad4 rda79d0fd  
    3535#define INT16   2
    3636#define INT32   4
     37#define INT64   8
    3738
    3839static void print_str(const char *str);
  • src/debug/print.c

    rf2ffad4 rda79d0fd  
    111111 *      and printed as a NULL terminated string.
    112112 * c    The next variant argument is treated as a single char.
     113 * p    The next variant argument is treated as a maximum
     114 *      bit-width integer with respect to architecture
     115 *      and printed in full hexadecimal width.
     116 * P    As with 'p', but '0x' is prefixed.
     117 * q    The next variant argument is treated as a 64b integer
     118 *      and printed in full hexadecimal width.
     119 * Q    As with 'q', but '0x' is prefixed.
    113120 * l    The next variant argument is treated as a 32b integer
    114121 *      and printed in full hexadecimal width.
     
    170177                                 * Hexadecimal conversions with fixed width.
    171178                                 */
     179                                case 'P':
     180                                        print_str("0x");
     181                                case 'p':
     182                                        print_fixed_hex(va_arg(ap, __native), sizeof(__native));
     183                                        goto loop;
     184
     185                                case 'Q':
     186                                        print_str("0x");
     187                                case 'q':
     188                                        print_fixed_hex(va_arg(ap, __native), INT64);
     189                                        goto loop;
     190
    172191                                case 'L':
    173192                                        print_str("0x");
  • src/main/main.c

    rf2ffad4 rda79d0fd  
    117117        printf("%s\n%s\n", project, copyright);
    118118
    119         printf("%L: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
     119        printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
    120120                config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024);
    121121
Note: See TracChangeset for help on using the changeset viewer.