[tool] Add nice debug info for Mako

Debugging Mako template error is quite hard. With this PR, at least it
gives the exact location in the template file when error occurs.

Reference: https://docs.makotemplates.org/en/latest/usage.html#handling-exceptions
diff --git a/util/uvmdvgen/gen_agent.py b/util/uvmdvgen/gen_agent.py
index afb848a..5f96d54 100644
--- a/util/uvmdvgen/gen_agent.py
+++ b/util/uvmdvgen/gen_agent.py
@@ -6,6 +6,7 @@
 
 import os
 
+from mako import exceptions
 from mako.template import Template
 from pkg_resources import resource_filename
 
@@ -52,8 +53,10 @@
 
         if not os.path.exists(path_dir): os.system("mkdir -p " + path_dir)
         with open(path_dir + "/" + fname, 'w') as fout:
-            fout.write(
-                tpl.render(
-                    name=name,
-                    has_separate_host_device_driver=
-                    has_separate_host_device_driver))
+            try:
+                fout.write(
+                    tpl.render(name=name,
+                               has_separate_host_device_driver=
+                               has_separate_host_device_driver))
+            except:
+                log.error(exceptions.text_error_template().render())