Imported Upstream version 0.160
[platform/upstream/elfutils.git] / libdw / dwarf_cu_getdwarf.c
similarity index 68%
rename from libdw/memory-access.c
rename to libdw/dwarf_cu_getdwarf.c
index 7666fb6..f8a2e9b 100644 (file)
@@ -1,5 +1,5 @@
-/* Out of line functions for memory-access.h macros.
-   Copyright (C) 2005, 2006 Red Hat, Inc.
+/* Retrieve Dwarf descriptor underlying a Dwarf_CU.
+   Copyright (C) 2014 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
+
+#include <stddef.h>
+
 #include "libdwP.h"
-#include "memory-access.h"
 
-uint64_t
-internal_function
-__libdw_get_uleb128 (uint64_t acc, unsigned int i, const unsigned char **addrp)
-{
-  unsigned char __b;
-  get_uleb128_rest_return (acc, i, addrp);
-}
 
-int64_t
-internal_function
-__libdw_get_sleb128 (int64_t acc, unsigned int i, const unsigned char **addrp)
+Dwarf *
+dwarf_cu_getdwarf (cu)
+     Dwarf_CU *cu;
 {
-  unsigned char __b;
-  int64_t _v = acc;
-  get_sleb128_rest_return (acc, i, addrp);
+  if (cu == NULL)
+    /* Some error occurred before.  */
+    return NULL;
+
+  return cu->dbg;
 }