New get_function_stack function

Return a list of all the function names currently in the call stack.

Change-Id: If37bef50f4b4d4fb467de92c5bb3ff23c7e4ac4d
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 6b8d560..ef0710d 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -11,6 +11,7 @@
 import collections
 import json
 import time
+import inspect
 try:
     import ConfigParser
 except ImportError:
@@ -580,3 +581,14 @@
     """
 
     return time.strftime("%y%m%d.%H%M%S", time.localtime(time.time()))
+
+
+def get_function_stack():
+    r"""
+    Return a list of all the function names currently in the call stack.
+
+    This function's name will be at offset 0.  This function's caller's name
+    will be at offset 1 and so on.
+    """
+
+    return [str(stack_frame[3]) for stack_frame in inspect.stack()]