This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ip2k port


This isn't needed. All targets a bi-endian. Even the i386:

/* Define the bit, byte, and word ordering of the machine. */
#define TARGET_BYTE_ORDER       BFD_ENDIAN_BIG

Ok, looks like this will need multi-arching. Can you file a bug report to track this?


/* Functions for dealing with epilogue call and return stubs. */
#define IGNORE_HELPER_CALL(pc) ip2k_ignore_helper (pc)
extern int ip2k_ignore_helper (CORE_ADDR pc);

This thread stuff could do with some comments, I'm also wondering if these constants belong in a header somewhere:


/* Threads.  */
#define IP2K_ISR_THREAD 1
#define IP2K_MAIN_THREAD 2
#define IP2K_VM_THREAD 3

Where sensible, use enums, rather than #define's:

#define DEBUG_NONE 0
#define DEBUG_NORMAL 1
#define DEBUG_EXTRA 2
#define DEBUG_MAX 3

Use NOINDENT (Ref: defs.h), otherwize, gdb_indent.sh will muck up these tables:

/* Prologue instructions - return address.
        push CALLL      (0x447f)
        push CALLH      (0x447e) */

Debug output is printed with "fprintf_unfiltered (gdb_stdlog, ...):
 if (debug_level >= DEBUG_MAX)
    printf_filtered ("ip2k_address_to_pointer\n");

Print CORE_ADDRS using "0x%s", paddr[_nz]():

warning ("invalid instruction pointer: 0x%08lx", addr);

Don't print internal errors using warning, call internal_error, or even just use ARRAY_SIZE in an assert:

warning ("internal error: ip2k_register_name: invalid register: 0x%08x", r

Use warning(), not printf_filtered for warnings:

printf_filtered ("warning: unable to find start of function of pc: 0x%08lx\n",
pc);


Call error() for errors:

printf_unfiltered ("Error: Return values longer than 8 bytes are not suppo
rted.\n");


If you re-factor the function (spliting it into two), the "goto" can be replaced by a "return:

finish:

I've fixed frame.c, so this is no longer needed:

  /* Check that we're not going round in circles with the same frame
     ID (but avoid applying the test to sentinel frames which do go
     round in circles).  Can't use frame_id_eq() as that doesn't yet
     compare the frame's PC value.  */

In the frame code, frame*memory, instead of target_read_memory, should be used:

if (target_read_memory (info->current_sp + 1, buf, 1) != 0)

finish:

It all looks byte order clean (which is the most common problem) and not to scary. The above are all minor tweaks.

BTW, do you have a list of people that contributed to the file?

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]