mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Consolidate buffer dumping; fix all occurrences of 'the the'
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1951 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -51,9 +51,25 @@
|
||||
#include <nuttx/symtab.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#undef NXFLAT_DUMPBUFFER /* Define to enable very verbose buffer dumping */
|
||||
|
||||
/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_BINFMT have to be
|
||||
* defined or NXFLAT_DUMPBUFFER does nothing.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_DEBUG_VERBOSE) || !defined (CONFIG_DEBUG_BINFMT)
|
||||
# undef NXFLAT_DUMPBUFFER
|
||||
#endif
|
||||
|
||||
#ifdef NXFLAT_DUMPBUFFER
|
||||
# define nxflat_dumpbuffer(m,b,n) bvdbgdumpbuffer(m,b,n)
|
||||
#else
|
||||
# define nxflat_dumpbuffer(m,b,n)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -72,7 +88,7 @@
|
||||
* Description:
|
||||
* Perform the NXFLAT_RELOC_TYPE_REL32I binding:
|
||||
*
|
||||
* Meaning: Object file contains a 32-bit offset into I-Space at the the offset.
|
||||
* Meaning: Object file contains a 32-bit offset into I-Space at the offset.
|
||||
* Fixup: Add mapped I-Space address to the offset.
|
||||
*
|
||||
* Returned Value:
|
||||
@@ -111,7 +127,7 @@ static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
* Description:
|
||||
* Perform the NXFLAT_RELOC_TYPE_REL32D binding:
|
||||
*
|
||||
* Meaning: Object file contains a 32-bit offset into D-Space at the the offset.
|
||||
* Meaning: Object file contains a 32-bit offset into D-Space at the offset.
|
||||
* Fixup: Add allocated D-Space address to the offset.
|
||||
*
|
||||
* Returned Value:
|
||||
@@ -246,7 +262,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
{
|
||||
|
||||
/* NXFLAT_RELOC_TYPE_REL32I Meaning: Object file contains a 32-bit offset
|
||||
* into I-Space at the the offset.
|
||||
* into I-Space at the offset.
|
||||
* Fixup: Add mapped I-Space address to the offset.
|
||||
*/
|
||||
|
||||
@@ -257,7 +273,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
break;
|
||||
|
||||
/* NXFLAT_RELOC_TYPE_REL32D Meaning: Object file contains a 32-bit offset
|
||||
* into D-Space at the the offset.
|
||||
* into D-Space at the offset.
|
||||
* Fixup: Add allocated D-Space address to the
|
||||
* offset.
|
||||
*/
|
||||
@@ -301,6 +317,15 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the relocation got */
|
||||
|
||||
#ifdef NXFLAT_DUMPBUFFER
|
||||
if (ret == OK && nrelocs > 0)
|
||||
{
|
||||
relocs = (FAR struct nxflat_reloc_s*)(offset - loadinfo->isize + loadinfo->dspace->region);
|
||||
nxflat_dumpbuffer("GOT", (FAR const ubyte*)relocs, nrelocs * sizeof(struct nxflat_reloc_s));
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -396,11 +421,19 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
|
||||
imports[i].i_funcaddress = (uint32)symbol->sym_value;
|
||||
|
||||
bvdbg("Bound imported function '%s' to address %08x\n",
|
||||
symname, imports[i].i_funcaddress);
|
||||
bvdbg("Bound import %d (%08p) to export 's' (%08x)\n",
|
||||
i, &imports[i], symname, imports[i].i_funcaddress);
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the relocation import table */
|
||||
|
||||
#ifdef NXFLAT_DUMPBUFFER
|
||||
if (nimports > 0)
|
||||
{
|
||||
nxflat_dumpbuffer("Imports", (FAR const ubyte*)imports, nimports * sizeof(struct nxflat_import_s));
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ int nxflat_verifyheader(const struct nxflat_hdr_s *header)
|
||||
|
||||
/* Check the FLT header -- magic number and revision.
|
||||
*
|
||||
* If the the magic number does not match. Just return
|
||||
* If the magic number does not match. Just return
|
||||
* silently. This is not our binary.
|
||||
*/
|
||||
|
||||
|
||||
+22
-23
@@ -55,13 +55,32 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#undef NXFLAT_DUMPBUFFER /* Define to enable very verbose buffer dumping */
|
||||
|
||||
/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_BINFMT have to be
|
||||
* defined or NXFLAT_DUMPBUFFER does nothing.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_DEBUG_VERBOSE) || !defined (CONFIG_DEBUG_BINFMT)
|
||||
# undef NXFLAT_DUMPBUFFER
|
||||
#endif
|
||||
|
||||
#ifdef NXFLAT_DUMPBUFFER
|
||||
# define nxflat_dumpbuffer(m,b,n) bvdbgdumpbuffer(m,b,n)
|
||||
#else
|
||||
# define nxflat_dumpbuffer(m,b,n)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) (a < b ? a : b)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int nxflat_loadbinary(struct binary_s *binp);
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_BINFMT)
|
||||
static void nxflat_dumpmemory(void *addr, int nbytes);
|
||||
static void nxflat_dumploadinfo(struct nxflat_loadinfo_s *loadinfo);
|
||||
#endif
|
||||
|
||||
@@ -79,25 +98,6 @@ static struct binfmt_s g_nxflatbinfmt =
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nnxflat_dumpmemory
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_BINFMT)
|
||||
static void nxflat_dumpmemory(void *addr, int nbytes)
|
||||
{
|
||||
ubyte *ptr;
|
||||
|
||||
bdbg(" ADDRESS VALUE\n");
|
||||
for (ptr = (ubyte*)addr; nbytes > 0; ptr += 4, nbytes -= 4)
|
||||
{
|
||||
bdbg(" %p: %02x %02x %02x %02x\n", ptr, ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define nxflat_dumpmemory(a,n)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxflat_dumploadinfo
|
||||
****************************************************************************/
|
||||
@@ -115,7 +115,7 @@ static void nxflat_dumploadinfo(struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
bdbg(" DSPACE:\n");
|
||||
bdbg(" dspace: %08lx\n", loadinfo->dspace);
|
||||
if (oadinfo->dspace != NULL)
|
||||
if (loadinfo->dspace != NULL)
|
||||
{
|
||||
bdbg(" crefs: %d\n", loadinfo->dspace->crefs);
|
||||
bdbg(" region: %08lx\n", loadinfo->dspace->region);
|
||||
@@ -196,8 +196,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
|
||||
binp->isize = loadinfo.isize;
|
||||
binp->stacksize = loadinfo.stacksize;
|
||||
|
||||
bvdbg("ENTRY CODE:\n");
|
||||
nxflat_dumpmemory(binp->entrypt, 16*sizeof(uint32));
|
||||
nxflat_dumpbuffer("Entry code", (FAR const ubyte*)binp->entrypt, MIN(binp->isize,512));
|
||||
nxflat_uninit(&loadinfo);
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user