diff --git a/.gitattributes b/.gitattributes
index 527066ee8183ed0652a1fc3cc3d4015109d4d069..5577a8f28ccecb6e936af557c61e25ebd0a721c6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -254,6 +254,7 @@ libIRDB/test/list_programs.cpp -text
 libIRDB/test/print_variant.cpp -text
 libIRDB/test/read_ehframe.cpp -text
 libIRDB/test/read_variantir.cpp -text
+libIRDB/test/rename_function.cpp -text
 libIRDB/test/unfix_calls.cpp -text
 libIRDB/test/unwind-pe.h -text
 libMEDSannotation/LICENSE.txt -text
diff --git a/libIRDB/test/Makefile.in b/libIRDB/test/Makefile.in
index 72938ac3c6c07e83ead56ea2b7f48b8511784c17..21523d33d58a36d6d184663b8e62cbd774adc267 100644
--- a/libIRDB/test/Makefile.in
+++ b/libIRDB/test/Makefile.in
@@ -7,7 +7,7 @@ OPT=-g @EXTRA_CXXFLAGS@
 
 PROGS=print_variant.exe list_programs.exe create_variant.exe create_variantir.exe read_variantir.exe clone.exe ilr.exe \
 	drop_variant.exe generate_spri.exe fill_in_cfg.exe fix_calls.exe fill_in_indtargs.exe unfix_calls.exe \
-	calc_conflicts.exe find_strings.exe build_callgraph.exe build_preds.exe
+	calc_conflicts.exe find_strings.exe build_callgraph.exe build_preds.exe rename_function.exe
 
 all: $(PROGS)
 
diff --git a/libIRDB/test/rename_function.cpp b/libIRDB/test/rename_function.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e8ca6097d90b03db21ec92a579f3d44d329ff9ee
--- /dev/null
+++ b/libIRDB/test/rename_function.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2014-2015 - Zephyr Software LLC
+ *
+ * This file may be used and modified for non-commercial purposes as long as
+ * all copyright, permission, and nonwarranty notices are preserved.
+ * Redistribution is prohibited without prior written consent from Zephyr
+ * Software.
+ *
+ * Please contact the authors for restrictions applying to commercial use.
+ *
+ * THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Author: Zephyr Software
+ * e-mail: jwd@zephyr-software.com
+ * URL   : http://www.zephyr-software.com/
+ *
+ */
+
+
+
+#include <libIRDB-core.hpp>
+#include <iostream>
+#include <stdlib.h>
+
+using namespace libIRDB;
+using namespace std;
+
+void rename_function(FileIR_t* firp, string oldfn, string newfn)
+{
+
+	assert(firp);
+
+	cout << "# ATTRIBUTE filename="<<firp->GetFile()->GetURL()<<endl;
+	cout << "# ATTRIBUTE old_function="<< oldfn << endl;
+	cout << "# ATTRIBUTE new_function="<< newfn << endl;
+
+	for(
+		set<Function_t*>::iterator it=firp->GetFunctions().begin();
+		it!=firp->GetFunctions().end();
+		++it
+	   )
+	{
+		Function_t* func=*it;
+		if (!func) continue;
+		if (func->GetName() == oldfn)
+		{
+			cout<<"Renaming function " << oldfn << " to " << newfn << endl;
+			func->SetName(newfn);					
+		}
+	}
+
+	firp->WriteToDB();
+}
+
+main(int argc, char* argv[])
+{
+	if(argc!=4)
+	{
+		cerr<<"Usage: rename_function <id> <oldfn> <newfn>"<<endl;
+		exit(-1);
+	}
+
+	VariantID_t *pidp=NULL;
+	FileIR_t *firp=NULL;
+	string oldfn(argv[2]);
+	string newfn(argv[3]);
+
+	assert(oldfn.size() > 0 && newfn.size() > 0);
+
+	/* setup the interface to the sql server */
+	pqxxDB_t pqxx_interface;
+	BaseObj_t::SetInterface(&pqxx_interface);
+
+	cout<<"Reading variant "<<string(argv[1])<<" from database." << endl;
+	try 
+	{
+		pidp=new VariantID_t(atoi(argv[1]));
+		assert(pidp->IsRegistered()==true);
+
+		for(set<File_t*>::iterator it=pidp->GetFiles().begin(); it!=pidp->GetFiles().end(); ++it)
+		{
+			File_t* this_file=*it;
+			assert(this_file);
+
+			// only do main file for now
+			if(this_file!=pidp->GetMainFile())
+				continue;
+
+			// read the db  
+			firp=new FileIR_t(*pidp,this_file);
+			
+			// rename the function
+			rename_function(firp, oldfn, newfn);
+
+			delete firp;
+		}
+		pqxx_interface.Commit();
+
+	}
+	catch (DatabaseError_t pnide)
+	{
+		cout<<"Unexpected database error: "<<pnide<<endl;
+		exit(-1);
+        }
+
+	cout<<"Done!"<<endl;
+
+	delete pidp;
+}
+