[PATCH 30/31] [DbgHelp]: dwarf & indent

Eric Pouech eric.pouech at wanadoo.fr
Sun Jun 18 14:32:30 CDT 2006


- indent the code as the rest of dbghelp module

A+
---

 dlls/dbghelp/dwarf.c |  191 +++++++++++++++++++++++++-------------------------
 1 files changed, 97 insertions(+), 94 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index e089a54..4d98b15 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -66,27 +66,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_dwarf
 #if 0
 static void dump(const void* ptr, unsigned len)
 {
-  int         i, j;
-  BYTE        msg[128];
-  static const char hexof[] = "0123456789abcdef";
-  const BYTE* x = (const BYTE*)ptr;
-
-  for (i = 0; i < len; i += 16)
-  {
-    sprintf(msg, "%08x: ", i);
-    memset(msg + 10, ' ', 3 * 16 + 1 + 16);
-    for (j = 0; j < min(16, len - i); j++)
+    int         i, j;
+    BYTE        msg[128];
+    static const char hexof[] = "0123456789abcdef";
+    const       BYTE* x = (const BYTE*)ptr;
+
+    for (i = 0; i < len; i += 16)
     {
-      msg[10 + 3 * j + 0] = hexof[x[i + j] >> 4];
-      msg[10 + 3 * j + 1] = hexof[x[i + j] & 15];
-      msg[10 + 3 * j + 2] = ' ';
-      msg[10 + 3 * 16 + 1 + j] = (x[i + j] >= 0x20 && x[i + j] < 0x7f) ?
-	x[i + j] : '.';
+        sprintf(msg, "%08x: ", i);
+        memset(msg + 10, ' ', 3 * 16 + 1 + 16);
+        for (j = 0; j < min(16, len - i); j++)
+        {
+            msg[10 + 3 * j + 0] = hexof[x[i + j] >> 4];
+            msg[10 + 3 * j + 1] = hexof[x[i + j] & 15];
+            msg[10 + 3 * j + 2] = ' ';
+            msg[10 + 3 * 16 + 1 + j] = (x[i + j] >= 0x20 && x[i + j] < 0x7f) ?
+                x[i + j] : '.';
+        }
+        msg[10 + 3 * 16] = ' ';
+        msg[10 + 3 * 16 + 1 + 16] = '\0';
+        TRACE("%s\n", msg);
     }
-    msg[10 + 3 * 16] = ' ';
-    msg[10 + 3 * 16 + 1 + 16] = '\0';
-    TRACE("%s\n", msg);
-  }
 }
 #endif
 
@@ -108,71 +108,72 @@ #include "dwarf.h"
  * Parsers
  */
 
-typedef struct dwarf2_abbrev_entry_attr_s {
-  unsigned long attribute;
-  unsigned long form;
-  struct dwarf2_abbrev_entry_attr_s* next;
+typedef struct dwarf2_abbrev_entry_attr_s
+{
+    unsigned long                       attribute;
+    unsigned long                       form;
+    struct dwarf2_abbrev_entry_attr_s*  next;
 } dwarf2_abbrev_entry_attr_t;
 
 typedef struct dwarf2_abbrev_entry_s
 {
-    unsigned long entry_code;
-    unsigned long tag;
-    unsigned char have_child;
-    unsigned num_attr;
-    dwarf2_abbrev_entry_attr_t* attrs;
+    unsigned long                       entry_code;
+    unsigned long                       tag;
+    unsigned char                       have_child;
+    unsigned                            num_attr;
+    dwarf2_abbrev_entry_attr_t*         attrs;
 } dwarf2_abbrev_entry_t;
 
 struct dwarf2_block
 {
-    unsigned                    size;
-    const char*                 ptr;
+    unsigned                            size;
+    const char*                         ptr;
 };
 
 union attribute
 {
-    unsigned long                   uvalue;
-    long                            svalue;
-    const char*                     string;
-    struct dwarf2_block*            block;
+    unsigned long                       uvalue;
+    long                                svalue;
+    const char*                         string;
+    struct dwarf2_block*                block;
 };
 
 typedef struct dwarf2_debug_info_s
 {
-    unsigned long               offset;
-    const dwarf2_abbrev_entry_t*abbrev;
-    struct symt*                symt;
-    union attribute*            attributes;
-    struct vector               children;
+    unsigned long                       offset;
+    const dwarf2_abbrev_entry_t*        abbrev;
+    struct symt*                        symt;
+    union attribute*                    attributes;
+    struct vector                       children;
 } dwarf2_debug_info_t;
 
 
 typedef struct dwarf2_section_s
 {
-    const unsigned char*        address;
-    unsigned                    size;
+    const unsigned char*                address;
+    unsigned                            size;
 } dwarf2_section_t;
 
 enum dwarf2_sections {section_debug, section_string, section_abbrev, section_line, section_max};
 
 typedef struct dwarf2_traverse_context_s
 {
-    const dwarf2_section_t*     sections;
-    unsigned                    section;
-    const unsigned char*        data;
-    const unsigned char*        start_data;
-    const unsigned char*        end_data;
-    unsigned long               offset;
-    unsigned char               word_size;
+    const dwarf2_section_t*             sections;
+    unsigned                            section;
+    const unsigned char*                data;
+    const unsigned char*                start_data;
+    const unsigned char*                end_data;
+    unsigned long                       offset;
+    unsigned char                       word_size;
 } dwarf2_traverse_context_t;
 
 typedef struct dwarf2_parse_context_s
 {
-    struct pool                 pool;
-    struct module*              module;
-    struct sparse_array         abbrev_table;
-    struct sparse_array         debug_info_table;
-    unsigned char               word_size;
+    struct pool                         pool;
+    struct module*                      module;
+    struct sparse_array                 abbrev_table;
+    struct sparse_array                 debug_info_table;
+    unsigned char                       word_size;
 } dwarf2_parse_context_t;
 
 /* forward declarations */
@@ -180,65 +181,67 @@ static struct symt* dwarf2_parse_enumera
 
 static unsigned char dwarf2_parse_byte(dwarf2_traverse_context_t* ctx)
 {
-  unsigned char uvalue = *(const unsigned char*) ctx->data;
-  ctx->data += 1;
-  return uvalue;
+    unsigned char uvalue = *(const unsigned char*) ctx->data;
+    ctx->data += 1;
+    return uvalue;
 }
 
 static unsigned short dwarf2_parse_u2(dwarf2_traverse_context_t* ctx)
 {
-  unsigned short uvalue = *(const unsigned short*) ctx->data;
-  ctx->data += 2;
-  return uvalue;
+    unsigned short uvalue = *(const unsigned short*) ctx->data;
+    ctx->data += 2;
+    return uvalue;
 }
 
 static unsigned long dwarf2_parse_u4(dwarf2_traverse_context_t* ctx)
 {
-  unsigned long uvalue = *(const unsigned int*) ctx->data;
-  ctx->data += 4;
-  return uvalue;
+    unsigned long uvalue = *(const unsigned int*) ctx->data;
+    ctx->data += 4;
+    return uvalue;
 }
 
 static unsigned long dwarf2_leb128_as_unsigned(dwarf2_traverse_context_t* ctx)
 {
-  unsigned long ret = 0;
-  unsigned char byte;
-  unsigned shift = 0;
+    unsigned long ret = 0;
+    unsigned char byte;
+    unsigned shift = 0;
 
-  assert( NULL != ctx );
+    assert( NULL != ctx );
 
-  while (1) {
-    byte = dwarf2_parse_byte(ctx);
-    ret |= (byte & 0x7f) << shift;
-    shift += 7;
-    if (0 == (byte & 0x80)) { break ; }
-  }
-
-  return ret;
+    while (1)
+    {
+        byte = dwarf2_parse_byte(ctx);
+        ret |= (byte & 0x7f) << shift;
+        shift += 7;
+        if (0 == (byte & 0x80)) { break ; }
+    }
+    return ret;
 }
 
 static long dwarf2_leb128_as_signed(dwarf2_traverse_context_t* ctx)
 {
-  long ret = 0;
-  unsigned char byte;
-  unsigned shift = 0;
-  const unsigned size = sizeof(int) * 8;
-
-  assert( NULL != ctx );
-
-  while (1) {
-    byte = dwarf2_parse_byte(ctx);
-    ret |= (byte & 0x7f) << shift;
-    shift += 7;
-    if (0 == (byte & 0x80)) { break ; }
-  }
-  /* as spec: sign bit of byte is 2nd high order bit (80x40)
-   *  -> 0x80 is used as flag.
-   */
-  if ((shift < size) && (byte & 0x40)) {
-    ret |= - (1 << shift);
-  }
-  return ret;
+    long ret = 0;
+    unsigned char byte;
+    unsigned shift = 0;
+    const unsigned size = sizeof(int) * 8;
+
+    assert( NULL != ctx );
+
+    while (1)
+    {
+        byte = dwarf2_parse_byte(ctx);
+        ret |= (byte & 0x7f) << shift;
+        shift += 7;
+        if (0 == (byte & 0x80)) { break ; }
+    }
+    /* as spec: sign bit of byte is 2nd high order bit (80x40)
+     *  -> 0x80 is used as flag.
+     */
+    if ((shift < size) && (byte & 0x40))
+    {
+        ret |= - (1 << shift);
+    }
+    return ret;
 }
 
 static unsigned long dwarf2_parse_addr(dwarf2_traverse_context_t* ctx)



More information about the wine-patches mailing list