summaryrefslogtreecommitdiffstats
path: root/libasm/disasm_begin.c
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2008-01-02 17:44:39 +0000
committerUlrich Drepper <[email protected]>2008-01-02 17:44:39 +0000
commit3cbdd387c752999255aea91600b5cfdefbeac7d0 (patch)
tree50c18bd26f8cd31f4c1aa3ce1d78bb98548659ba /libasm/disasm_begin.c
parentad024afc93dcd0f4797b3e80bfb6b80c34da5c12 (diff)
propagate from branch 'com.redhat.elfutils.disasm' (head d15b4eb794e81e477f9896fe82a74cb5ecf4514c)
to branch 'com.redhat.elfutils' (head eaacbf01f8cc89d043ec6eca9b5e35cb5c4cde06)
Diffstat (limited to 'libasm/disasm_begin.c')
-rw-r--r--libasm/disasm_begin.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/libasm/disasm_begin.c b/libasm/disasm_begin.c
new file mode 100644
index 00000000..5cdb5424
--- /dev/null
+++ b/libasm/disasm_begin.c
@@ -0,0 +1,49 @@
+/* Create context descriptor for disassembler.
+ Copyright (C) 2005 Red Hat, Inc.
+ Written by Ulrich Drepper <[email protected]>, 2005.
+
+ This program is Open Source software; you can redistribute it and/or
+ modify it under the terms of the Open Software License version 1.0 as
+ published by the Open Source Initiative.
+
+ You should have received a copy of the Open Software License along
+ with this program; if not, you may obtain a copy of the Open Software
+ License version 1.0 from http://www.opensource.org/licenses/osl.php or
+ by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+ 3001 King Ranch Road, Ukiah, CA 95482. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "libasmP.h"
+#include "../libebl/libeblP.h"
+
+
+DisasmCtx_t *
+disasm_begin (Ebl *ebl, Elf *elf, DisasmGetSymCB_t symcb)
+{
+ if (ebl == NULL)
+ return NULL;
+
+ if (ebl->disasm == NULL)
+ {
+ __libasm_seterrno (ASM_E_ENOSUP);
+ return NULL;
+ }
+
+ DisasmCtx_t *ctx = (DisasmCtx_t *) malloc (sizeof (DisasmCtx_t));
+ if (ctx == NULL)
+ {
+ __libasm_seterrno (ASM_E_NOMEM);
+ return NULL;
+ }
+
+ ctx->ebl = ebl;
+ ctx->elf = elf;
+ ctx->symcb = symcb;
+
+ return ctx;
+}