2 * This file is part of ltrace.
3 * Copyright (C) 2011,2012 Petr Machata, Red Hat Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 /* XXX isn't SYSCALL TOF just a different ABI? Maybe we needed to
28 * support variant ABIs all along. */
30 LT_TOF_FUNCTION, /* A real library function */
31 LT_TOF_FUNCTIONR, /* Return from a real library function */
32 LT_TOF_SYSCALL, /* A syscall */
33 LT_TOF_SYSCALLR, /* Return from a syscall */
36 /* The contents of the structure is defined by the back end. */
39 /* Initialize argument fetching. Returns NULL on failure. RET_INFO
40 * is the return type of the function. */
41 struct fetch_context *fetch_arg_init(enum tof type, struct Process *proc,
42 struct arg_type_info *ret_info);
44 /* Make a clone of context. */
45 struct fetch_context *fetch_arg_clone(struct Process *proc,
46 struct fetch_context *context);
48 /* Load next argument. The function returns 0 on success or a
49 * negative value on failure. The extracted value is stored in
51 int fetch_arg_next(struct fetch_context *context, enum tof type,
53 struct arg_type_info *info, struct value *valuep);
55 /* Load return value. The function returns 0 on success or a negative
56 * value on failure. The extracted value is stored in *VALUEP. */
57 int fetch_retval(struct fetch_context *context, enum tof type,
59 struct arg_type_info *info, struct value *valuep);
61 /* Destroy fetch context. CONTEXT shall be the same memory location
62 * that was passed to fetch_arg_next. */
63 void fetch_arg_done(struct fetch_context *context);
65 /* Called before fetching arguments that come from parameter packs.
66 * Returns 0 on success or a negative value on failure. */
67 int fetch_param_pack_start(struct fetch_context *context,
68 enum param_pack_flavor ppflavor);
70 /* Called after a parameter pack has been fetched. */
71 void fetch_param_pack_end(struct fetch_context *context);
74 /* The following callbacks have to be implemented in backend if arch.h
75 * defines ARCH_HAVE_FETCH_ARG. These backend callbacks correspond to
77 struct fetch_context *arch_fetch_arg_init(enum tof type, struct Process *proc,
78 struct arg_type_info *ret_info);
79 struct fetch_context *arch_fetch_arg_clone(struct Process *proc,
80 struct fetch_context *context);
81 int arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
82 struct Process *proc, struct arg_type_info *info,
83 struct value *valuep);
84 int arch_fetch_retval(struct fetch_context *ctx, enum tof type,
85 struct Process *proc, struct arg_type_info *info,
86 struct value *valuep);
87 void arch_fetch_arg_done(struct fetch_context *context);
89 /* The following callbacks have to be implemented in backend if arch.h
90 * defines ARCH_HAVE_FETCH_ARG and ARCH_HAVE_FETCH_PACK. */
91 int arch_fetch_param_pack_start(struct fetch_context *context,
92 enum param_pack_flavor ppflavor);
93 void arch_fetch_param_pack_end(struct fetch_context *context);