aboutsummaryrefslogtreecommitdiff
path: root/libyasm/dbgfmt.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-03-28 15:33:02 +0000
committerTorne (Richard Coles) <torne@google.com>2013-03-28 15:33:02 +0000
commitc580f3c787d8ad2dcccceb4438b7572d9713a296 (patch)
treed8f5d6b20552cfe016f9af38440fd9caacf4a188 /libyasm/dbgfmt.h
parent1fe0cccaa99357259c9ab42ce88626b95856b77c (diff)
parent53137eb420065ea05c21ae0728a67ead80f17e1f (diff)
downloadpatched-yasm-c580f3c787d8ad2dcccceb4438b7572d9713a296.tar.gz
This commit was generated by merge_to_master.py. Change-Id: I1975b1fce5e96446e4fa27feda7009fe340d4cff
Diffstat (limited to 'libyasm/dbgfmt.h')
-rw-r--r--libyasm/dbgfmt.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/libyasm/dbgfmt.h b/libyasm/dbgfmt.h
new file mode 100644
index 0000000..8e038bb
--- /dev/null
+++ b/libyasm/dbgfmt.h
@@ -0,0 +1,122 @@
+/**
+ * \file libyasm/dbgfmt.h
+ * \brief YASM debug format interface.
+ *
+ * \license
+ * Copyright (C) 2002-2007 Peter Johnson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ * \endlicense
+ */
+#ifndef YASM_DBGFMT_H
+#define YASM_DBGFMT_H
+
+#ifndef YASM_DOXYGEN
+/** Base #yasm_dbgfmt structure. Must be present as the first element in any
+ * #yasm_dbgfmt implementation.
+ */
+typedef struct yasm_dbgfmt_base {
+ /** #yasm_dbgfmt_module implementation for this debug format. */
+ const struct yasm_dbgfmt_module *module;
+} yasm_dbgfmt_base;
+#endif
+
+/** Debug format module interface. */
+struct yasm_dbgfmt_module {
+ /** One-line description of the debug format. */
+ const char *name;
+
+ /** Keyword used to select debug format. */
+ const char *keyword;
+
+ /** NULL-terminated list of directives. NULL if none. */
+ /*@null@*/ const yasm_directive *directives;
+
+ /** Create debug format.
+ * Module-level implementation of yasm_dbgfmt_create().
+ * The filenames are provided solely for informational purposes.
+ * \param object object
+ * \return NULL if object format does not provide needed support.
+ */
+ /*@null@*/ /*@only@*/ yasm_dbgfmt * (*create) (yasm_object *object);
+
+ /** Module-level implementation of yasm_dbgfmt_destroy().
+ * Call yasm_dbgfmt_destroy() instead of calling this function.
+ */
+ void (*destroy) (/*@only@*/ yasm_dbgfmt *dbgfmt);
+
+ /** Module-level implementation of yasm_dbgfmt_generate().
+ * Call yasm_dbgfmt_generate() instead of calling this function.
+ */
+ void (*generate) (yasm_object *object, yasm_linemap *linemap,
+ yasm_errwarns *errwarns);
+};
+
+/** Get the keyword used to select a debug format.
+ * \param dbgfmt debug format
+ * \return keyword
+ */
+const char *yasm_dbgfmt_keyword(const yasm_dbgfmt *dbgfmt);
+
+/** Initialize debug output for use. Must call before any other debug
+ * format functions. The filenames are provided solely for informational
+ * purposes.
+ * \param module debug format module
+ * \param object object to generate debugging information for
+ * \return NULL if object format does not provide needed support.
+ */
+/*@null@*/ /*@only@*/ yasm_dbgfmt *yasm_dbgfmt_create
+ (const yasm_dbgfmt_module *module, yasm_object *object);
+
+/** Cleans up any allocated debug format memory.
+ * \param dbgfmt debug format
+ */
+void yasm_dbgfmt_destroy(/*@only@*/ yasm_dbgfmt *dbgfmt);
+
+/** Generate debugging information bytecodes.
+ * \param object object
+ * \param linemap virtual/physical line mapping
+ * \param errwarns error/warning set
+ * \note Errors and warnings are stored into errwarns.
+ */
+void yasm_dbgfmt_generate(yasm_object *object, yasm_linemap *linemap,
+ yasm_errwarns *errwarns);
+
+#ifndef YASM_DOXYGEN
+
+/* Inline macro implementations for dbgfmt functions */
+
+#define yasm_dbgfmt_keyword(dbgfmt) \
+ (((yasm_dbgfmt_base *)dbgfmt)->module->keyword)
+
+#define yasm_dbgfmt_create(module, object) \
+ module->create(object)
+
+#define yasm_dbgfmt_destroy(dbgfmt) \
+ ((yasm_dbgfmt_base *)dbgfmt)->module->destroy(dbgfmt)
+#define yasm_dbgfmt_generate(object, linemap, ews) \
+ ((yasm_dbgfmt_base *)((object)->dbgfmt))->module->generate \
+ (object, linemap, ews)
+
+#endif
+
+#endif