[ltrace-commits] 23/40: renamed type_hash -> type_dieoffset_hash

Petr Machata pmachata-guest at moszumanska.debian.org
Sun May 11 22:38:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

pmachata-guest pushed a commit to branch master
in repository ltrace.

commit cd243b1a901ccb084fd248a87c56ee849c9589ac
Author: Dima Kogan <dima at secretsauce.net>
Date:   Sun Apr 27 16:30:12 2014 -0700

    renamed type_hash -> type_dieoffset_hash
---
 dwarf_prototypes.c | 60 +++++++++++++++++++++++++++---------------------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/dwarf_prototypes.c b/dwarf_prototypes.c
index c55fb99..147f536 100644
--- a/dwarf_prototypes.c
+++ b/dwarf_prototypes.c
@@ -44,7 +44,7 @@
 	break                       /* no sibling exists */
 
 static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct protolib* plib,
-					 struct dict* type_hash);
+					 struct dict* type_dieoffset_hash);
 
 
 #if 0
@@ -377,7 +377,7 @@ static bool get_enum(struct arg_type_info* enum_info, Dwarf_Die* parent)
 }
 
 static bool get_array(struct arg_type_info* array_info, Dwarf_Die* parent, struct protolib* plib,
-					  struct dict* type_hash)
+					  struct dict* type_dieoffset_hash)
 {
 	Dwarf_Die type_die;
 	if (!get_type_die(&type_die, parent)) {
@@ -386,7 +386,7 @@ static bool get_array(struct arg_type_info* array_info, Dwarf_Die* parent, struc
 	}
 
 	struct arg_type_info* info;
-	if (!get_type(&info, &type_die, plib, type_hash)) {
+	if (!get_type(&info, &type_die, plib, type_dieoffset_hash)) {
 		complain(parent, "Couldn't figure out array's type");
 		return false;
 	}
@@ -458,7 +458,7 @@ static bool get_array(struct arg_type_info* array_info, Dwarf_Die* parent, struc
 }
 
 static bool get_structure(struct arg_type_info* struct_info, Dwarf_Die* parent, struct protolib* plib,
-						  struct dict* type_hash)
+						  struct dict* type_dieoffset_hash)
 {
 	type_init_struct(struct_info);
 
@@ -483,7 +483,7 @@ static bool get_structure(struct arg_type_info* struct_info, Dwarf_Die* parent,
 		}
 
 		struct arg_type_info* member_info = NULL;
-		if (!get_type(&member_info, &type_die, plib, type_hash)) {
+		if (!get_type(&member_info, &type_die, plib, type_dieoffset_hash)) {
 			complain(&die, "Couldn't parse type from DWARF data");
 			return false;
 		}
@@ -498,10 +498,10 @@ static bool get_structure(struct arg_type_info* struct_info, Dwarf_Die* parent,
 // Reads the type in the die into the given structure
 // Returns true on sucess
 static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct protolib* plib,
-					 struct dict* type_hash)
+					 struct dict* type_dieoffset_hash)
 {
 	Dwarf_Off die_offset = dwarf_dieoffset(type_die);
-	struct arg_type_info** found_type = dict_find(type_hash, &die_offset);
+	struct arg_type_info** found_type = dict_find(type_dieoffset_hash, &die_offset);
 	if (found_type != NULL) {
 		*info = *found_type;
 		complain(type_die, "Read pre-computed type: %p", *info);
@@ -529,7 +529,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 	case DW_TAG_base_type:
 		*info = type_get_simple(get_base_type(type_die));
 		complain(type_die, "Storing base type: %p", *info);
-		dict_insert(type_hash, &die_offset, info);
+		dict_insert(type_dieoffset_hash, &die_offset, info);
 		return true;
 
 	case DW_TAG_subroutine_type:
@@ -538,7 +538,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 		// these, it'll get a segfault
 		*info = type_get_simple(ARGTYPE_VOID);
 		complain(type_die, "Storing subroutine type: %p", *info);
-		dict_insert(type_hash, &die_offset, info);
+		dict_insert(type_dieoffset_hash, &die_offset, info);
 		return true;
 
 	case DW_TAG_pointer_type:
@@ -547,7 +547,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 			// the pointed-to type isn't defined, so I report a void*
 			*info = type_get_simple(ARGTYPE_VOID);
 			complain(type_die, "Storing void-pointer type: %p", *info);
-			dict_insert(type_hash, &die_offset, info);
+			dict_insert(type_dieoffset_hash, &die_offset, info);
 			return true;
 		}
 
@@ -559,8 +559,8 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 		type_init_pointer(*info, NULL, 0);
 
 		complain(type_die, "Storing pointer type: %p", *info);
-		dict_insert(type_hash, &die_offset, info);
-		return get_type(&(*info)->u.ptr_info.info, &next_die, plib, type_hash);
+		dict_insert(type_dieoffset_hash, &die_offset, info);
+		return get_type(&(*info)->u.ptr_info.info, &next_die, plib, type_dieoffset_hash);
 
 	case DW_TAG_structure_type:
 		*info = calloc(1, sizeof(struct arg_type_info));
@@ -570,8 +570,8 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 		}
 
 		complain(type_die, "Storing struct type: %p", *info);
-		dict_insert(type_hash, &die_offset, info);
-		return get_structure(*info, type_die, plib, type_hash);
+		dict_insert(type_dieoffset_hash, &die_offset, info);
+		return get_structure(*info, type_die, plib, type_dieoffset_hash);
 
 
 	case DW_TAG_typedef:
@@ -581,7 +581,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 		bool res = true;
 		if (get_type_die(&next_die, type_die)) {
 			complain(type_die, "Storing const/typedef type: %p", *info);
-			res = get_type(info, &next_die, plib, type_hash);
+			res = get_type(info, &next_die, plib, type_dieoffset_hash);
 		} else {
 			// no type. Use 'void'. Normally I'd think this is bogus, but stdio
 			// typedefs something to void
@@ -589,7 +589,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 			complain(type_die, "Storing void type: %p", *info);
 		}
 		if (res)
-			dict_insert(type_hash, &die_offset, info);
+			dict_insert(type_dieoffset_hash, &die_offset, info);
 		return res;
 	}
 
@@ -603,7 +603,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 		}
 
 		complain(type_die, "Storing enum int: %p", *info);
-		dict_insert(type_hash, &die_offset, info);
+		dict_insert(type_dieoffset_hash, &die_offset, info);
 		return get_enum(*info, type_die);
 
 	case DW_TAG_array_type:
@@ -614,8 +614,8 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 		}
 
 		complain(type_die, "Storing array: %p", *info);
-		dict_insert(type_hash, &die_offset, info);
-		return get_array(*info, type_die, plib, type_hash);
+		dict_insert(type_dieoffset_hash, &die_offset, info);
+		return get_array(*info, type_die, plib, type_dieoffset_hash);
 
 	case DW_TAG_union_type:
 		*info = type_get_simple(ARGTYPE_VOID);
@@ -631,7 +631,7 @@ static bool get_type(struct arg_type_info** info, Dwarf_Die* type_die, struct pr
 }
 
 static bool get_prototype(struct prototype* proto, Dwarf_Die* subroutine, struct protolib* plib,
-						  struct dict* type_hash)
+						  struct dict* type_dieoffset_hash)
 {
 	// First, look at the return type. This is stored in a DW_AT_type tag in the
 	// subroutine DIE. If there is no such tag, this function returns void
@@ -647,7 +647,7 @@ static bool get_prototype(struct prototype* proto, Dwarf_Die* subroutine, struct
 		}
 		proto->own_return_info = 0;
 
-		if (!get_type(&proto->return_info, &return_type_die, plib, type_hash)) {
+		if (!get_type(&proto->return_info, &return_type_die, plib, type_dieoffset_hash)) {
 			complain(subroutine, "Couldn't get return type");
 			return false;
 		}
@@ -673,7 +673,7 @@ static bool get_prototype(struct prototype* proto, Dwarf_Die* subroutine, struct
 			}
 
 			struct arg_type_info* arg_type_info = NULL;
-			if (!get_type(&arg_type_info, &type_die, plib, type_hash)) {
+			if (!get_type(&arg_type_info, &type_die, plib, type_dieoffset_hash)) {
 				complain(&arg_die, "Couldn't parse arg type from DWARF data");
 				return false;
 			}
@@ -698,7 +698,7 @@ static bool get_prototype(struct prototype* proto, Dwarf_Die* subroutine, struct
 }
 
 static bool import_subprogram(struct protolib* plib, struct library* lib,
-							  struct dict* type_hash,
+							  struct dict* type_dieoffset_hash,
 							  Dwarf_Die* die)
 {
 	// I use the linkage function name if there is one, otherwise the
@@ -739,7 +739,7 @@ static bool import_subprogram(struct protolib* plib, struct library* lib,
 	}
 	prototype_init(proto);
 
-	if (!get_prototype(proto, die, plib, type_hash)) {
+	if (!get_prototype(proto, die, plib, type_dieoffset_hash)) {
 		complain(die, "couldn't get prototype");
 		return false;
 	}
@@ -749,7 +749,7 @@ static bool import_subprogram(struct protolib* plib, struct library* lib,
 }
 
 static bool process_die_compileunit(struct protolib* plib, struct library* lib,
-									struct dict* type_hash,
+									struct dict* type_dieoffset_hash,
 									Dwarf_Die* parent)
 {
 	Dwarf_Die die;
@@ -760,7 +760,7 @@ static bool process_die_compileunit(struct protolib* plib, struct library* lib,
 
 	while (1) {
 		if (dwarf_tag(&die) == DW_TAG_subprogram)
-			if(!import_subprogram(plib, lib, type_hash, &die))
+			if(!import_subprogram(plib, lib, type_dieoffset_hash, &die))
 				return false;
 
 		NEXT_SIBLING(&die);
@@ -774,9 +774,9 @@ static bool import(struct protolib* plib, struct library* lib, Dwfl* dwfl)
 	// A map from DIE addresses (Dwarf_Off) to type structures (struct
 	// arg_type_info*). This is created and filled in at the start of each
 	// import, and deleted when the import is complete
-	struct dict type_hash;
+	struct dict type_dieoffset_hash;
 
-	dict_init(&type_hash, sizeof(Dwarf_Off), sizeof(struct arg_type_info*),
+	dict_init(&type_dieoffset_hash, sizeof(Dwarf_Off), sizeof(struct arg_type_info*),
 			  dwarf_die_hash, dwarf_die_eq, NULL);
 
 	bool result = true;
@@ -785,7 +785,7 @@ static bool import(struct protolib* plib, struct library* lib, Dwfl* dwfl)
     Dwarf_Die* die = NULL;
     while ((die = dwfl_nextcu(dwfl, die, &bias)) != NULL) {
         if (dwarf_tag(die) == DW_TAG_compile_unit) {
-            if (!process_die_compileunit(plib, lib, &type_hash, die)) {
+            if (!process_die_compileunit(plib, lib, &type_dieoffset_hash, die)) {
                 complain(die, "Error reading compile unit");
 				exit(1);
 
@@ -801,7 +801,7 @@ static bool import(struct protolib* plib, struct library* lib, Dwfl* dwfl)
         }
     }
 
-	dict_destroy(&type_hash, NULL, NULL, NULL);
+	dict_destroy(&type_dieoffset_hash, NULL, NULL, NULL);
 	return result;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git



More information about the ltrace-commits mailing list