Imported Upstream version 1.2
[platform/upstream/libunwind.git] / src / ia64 / Gfind_unwind_table.c
index f7d3168..9fd2707 100644 (file)
@@ -1,6 +1,6 @@
 /* libunwind - a platform-independent unwind library
    Copyright (C) 2003-2004 Hewlett-Packard Co
-       Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+        Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 
 This file is part of libunwind.
 
@@ -46,14 +46,14 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base)
   if (pdyn)
     {
       /* If we have a PT_DYNAMIC program header, fetch the gp-value
-        from the DT_PLTGOT entry.  */
+         from the DT_PLTGOT entry.  */
       Elf64_Dyn *dyn = (Elf64_Dyn *) (pdyn->p_offset + (char *) edi->ei.image);
       for (; dyn->d_tag != DT_NULL; ++dyn)
-       if (dyn->d_tag == DT_PLTGOT)
-         {
-           gp = (Elf64_Addr) dyn->d_un.d_ptr + load_base;
-           goto done;
-         }
+        if (dyn->d_tag == DT_PLTGOT)
+          {
+            gp = (Elf64_Addr) dyn->d_un.d_ptr + load_base;
+            goto done;
+          }
     }
 
   /* Without a PT_DYAMIC header, lets try to look for a non-empty .opd
@@ -67,8 +67,8 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base)
   if (soff + ehdr->e_shnum * ehdr->e_shentsize > edi->ei.size)
     {
       Debug (1, "section table outside of image? (%lu > %lu)",
-            soff + ehdr->e_shnum * ehdr->e_shentsize,
-            edi->ei.size);
+             soff + ehdr->e_shnum * ehdr->e_shentsize,
+             edi->ei.size);
       goto done;
     }
 
@@ -78,11 +78,11 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base)
   for (i = 0; i < ehdr->e_shnum; ++i)
     {
       if (strcmp (strtab + shdr->sh_name, ".opd") == 0
-         && shdr->sh_size >= 16)
-       {
-         gp = ((Elf64_Addr *) ((char *) edi->ei.image + shdr->sh_offset))[1];
-         goto done;
-       }
+          && shdr->sh_size >= 16)
+        {
+          gp = ((Elf64_Addr *) ((char *) edi->ei.image + shdr->sh_offset))[1];
+          goto done;
+        }
       shdr = (Elf64_Shdr *) (((char *) shdr) + ehdr->e_shentsize);
     }
 
@@ -93,8 +93,8 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base)
 
 int
 ia64_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as,
-                        char *path, unw_word_t segbase, unw_word_t mapoff,
-                        unw_word_t ip)
+                         char *path, unw_word_t segbase, unw_word_t mapoff,
+                         unw_word_t ip)
 {
   Elf64_Phdr *phdr, *ptxt = NULL, *punw = NULL, *pdyn = NULL;
   Elf64_Ehdr *ehdr;
@@ -109,23 +109,23 @@ ia64_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as,
   for (i = 0; i < ehdr->e_phnum; ++i)
     {
       switch (phdr[i].p_type)
-       {
-       case PT_LOAD:
-         if (phdr[i].p_offset == mapoff)
-           ptxt = phdr + i;
-         break;
-
-       case PT_IA_64_UNWIND:
-         punw = phdr + i;
-         break;
-
-       case PT_DYNAMIC:
-         pdyn = phdr + i;
-         break;
-
-       default:
-         break;
-       }
+        {
+        case PT_LOAD:
+          if (phdr[i].p_offset == mapoff)
+            ptxt = phdr + i;
+          break;
+
+        case PT_IA_64_UNWIND:
+          punw = phdr + i;
+          break;
+
+        case PT_DYNAMIC:
+          pdyn = phdr + i;
+          break;
+
+        default:
+          break;
+        }
     }
   if (!ptxt || !punw)
     return 0;