objectFile.c File Reference

Implementation of the object file interface. More...

#include "objectFile.h"
#include "hashmap.h"
#include "graph.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

Include dependency graph for objectFile.c:

Go to the source code of this file.

Defines

#define SO_FOUNDNAME   1
#define SO_FOUNDSECTION   2
#define SO_PREFIX_COUNT   (sizeof(prefix)/sizeof(char*))
#define SO_WEAK_COUNT   (sizeof(weak)/sizeof(char*))

Functions

static char * trim (char *src)
 Removes leading space from a string.
static void upper (char *src)
 Converts a string into upper case.
static void parseRelocSection (graph *src, FILE *file)
 Parses the relocation section of the generated object file.
static void colorizeGraph (graph *seed, unsigned long color)
 Colorizes a graph starting from a given seed.
objectFile * objectFileCreate (const char *name)
 Creates a new object file and returns a pointer to it.
void objectFileCollect (objectFile *src, FILE *file)
 Collects all the sections from a objdump generated file.
void objectFileCompute (list *oFiles, FILE *file)
 Computes the dependencies between the various sections of the objects.
void objectFileColorize (const char *seed, unsigned long color)
 Recursively colorizes the dependency graph starting with seed. Two colors get mixed using binary OR.
list * objectFileGetUsed (objectFile *src)
 Returns a list containing all used sections.
list * objectFileGetUnused (objectFile *src)
 Returns a list containing all unused sections.
const char * objectFileGetName (objectFile *src)
 Returns the name of the given object file.
void objectFileDumpMap (list *oFiles)
 Dumps the dependency graph XML-like formatted to stdout.
void objectFileDumpUsed (list *oFiles)
 Dumps the used sections in XML-like formatted to stdout.
void objectFileDumpUnused (list *oFiles)
 Dumps the unused sections in XML format to stdout.

Variables

static const char * prefix []
static const char * weak []
static hashmap * sectionMap = 0
static list * unknownSection = 0


Detailed Description

Implementation of the object file interface.

Author:
Dorian Weber

Definition in file objectFile.c.


Define Documentation

#define SO_FOUNDNAME   1

Definition at line 17 of file objectFile.c.

#define SO_FOUNDSECTION   2

Definition at line 18 of file objectFile.c.

#define SO_PREFIX_COUNT   (sizeof(prefix)/sizeof(char*))

Definition at line 20 of file objectFile.c.

#define SO_WEAK_COUNT   (sizeof(weak)/sizeof(char*))

Definition at line 21 of file objectFile.c.


Function Documentation

static void colorizeGraph ( graph *  seed,
unsigned long  color 
) [static]

Colorizes a graph starting from a given seed.

Parameters:
[in] seed initial node
[in] color the color

Definition at line 156 of file objectFile.c.

void objectFileCollect ( objectFile *  src,
FILE *  file 
)

Collects all the sections from a objdump generated file.

Definition at line 182 of file objectFile.c.

void objectFileColorize ( const char *  seed,
unsigned long  color 
)

Recursively colorizes the dependency graph starting with seed. Two colors get mixed using binary OR.

Definition at line 376 of file objectFile.c.

void objectFileCompute ( list *  oFiles,
FILE *  file 
)

Computes the dependencies between the various sections of the objects.

Definition at line 245 of file objectFile.c.

objectFile* objectFileCreate ( const char *  name  ) 

Creates a new object file and returns a pointer to it.

Definition at line 172 of file objectFile.c.

void objectFileDumpMap ( list *  oFiles  ) 

Dumps the dependency graph XML-like formatted to stdout.

Definition at line 423 of file objectFile.c.

void objectFileDumpUnused ( list *  oFiles  ) 

Dumps the unused sections in XML format to stdout.

Definition at line 486 of file objectFile.c.

void objectFileDumpUsed ( list *  oFiles  ) 

Dumps the used sections in XML-like formatted to stdout.

Definition at line 463 of file objectFile.c.

const char* objectFileGetName ( objectFile *  src  ) 

Returns the name of the given object file.

Definition at line 418 of file objectFile.c.

list* objectFileGetUnused ( objectFile *  src  ) 

Returns a list containing all unused sections.

Definition at line 401 of file objectFile.c.

list* objectFileGetUsed ( objectFile *  src  ) 

Returns a list containing all used sections.

Definition at line 384 of file objectFile.c.

static void parseRelocSection ( graph *  src,
FILE *  file 
) [static]

Parses the relocation section of the generated object file.

Parameters:
[in] src marks the node assigned to the section
[in] file handle to the file

Definition at line 68 of file objectFile.c.

static char* trim ( char *  src  )  [static]

Removes leading space from a string.

Parameters:
[in] src string to trim
Returns:
src incremented to the first non-whitespace character

Definition at line 45 of file objectFile.c.

static void upper ( char *  src  )  [static]

Converts a string into upper case.

Parameters:
[in] src string to convert

Definition at line 55 of file objectFile.c.


Variable Documentation

const char* prefix[] [static]

Initial value:

    { ".text$", ".rdata$", ".data$" }

Definition at line 23 of file objectFile.c.

hashmap* sectionMap = 0 [static]

Definition at line 28 of file objectFile.c.

list* unknownSection = 0 [static]

Definition at line 29 of file objectFile.c.

const char* weak[] [static]

Initial value:

    { ".rdata" }

Definition at line 25 of file objectFile.c.


Generated on Fri Jun 5 15:31:57 2009 for DeadStrip Utility by  doxygen 1.5.8