void *callback_param)
{
basic_block bb;
+ expanded_location xloc;
aop_assert (pc->kind == ATP_ASSIGN);
if (stmt_matches_pointcut (pc, stmt))
{
struct aop_joinpoint jp;
- init_joinpoint (&jp, &gsi, pc, stmt);
+ xloc = expand_location (gimple_location (stmt));
+ init_joinpoint (&jp, &gsi, pc, stmt, xloc.line, xloc.file);
cb (&jp, callback_param);
}
}
#include <basic-block.h>
#include <gimple.h>
#include <string.h>
+#include <tree-flow.h>
#include "aop.h"
#include "aop-pointcut.h"
* \{
*/
+static expanded_location
+get_function_entry_xloc()
+{
+ basic_block bb;
+ expanded_location xloc;
+
+ bb = ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun);
+ xloc = expand_location (gimple_location (first_stmt (bb->next_bb)));
+ return xloc;
+}
+
+
+
static void
op_join_on_function_entry (struct aop_pointcut *pc, join_callback cb,
void *callback_param)
{
struct aop_joinpoint jp;
gimple_stmt_iterator gsi;
+ expanded_location xloc;
aop_assert (pc->kind == ATP_ENTRY);
op_prepare_entry when it is time to insert advice. (We poison it
just to make sure that initialization is getting called.)*/
memset (&gsi, 0xfa, sizeof (gimple_stmt_iterator));
-
- init_joinpoint (&jp, &gsi, pc, NULL);
+ xloc = get_function_entry_xloc ();
+ init_joinpoint (&jp, &gsi, pc, NULL, xloc.line, xloc.file);
cb (&jp, callback_param);
}
{
basic_block bb;
gimple stmt;
+ expanded_location xloc;
aop_assert (pc->kind == ATP_EXIT);
FOR_EACH_BB(bb)
if (gimple_code (stmt) == GIMPLE_RETURN)
{
struct aop_joinpoint jp;
- init_joinpoint (&jp, &gsi, pc, stmt);
+ xloc = expand_location (gimple_location (stmt));
+ init_joinpoint (&jp, &gsi, pc, stmt, xloc.line, xloc.file);
cb (&jp, callback_param);
/* It's possible that gsi is no longer a valid iterator
{
basic_block my_basic_block;
gimple_stmt_iterator gsi;
+ expanded_location xloc;
aop_assert (pc->kind == ATP_CALL);
FOR_EACH_BB(my_basic_block)
{
for (gsi = gsi_start_bb (my_basic_block) ; !gsi_end_p (gsi) ;
- gsi_next (&gsi))
+ gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
if (call_matches (pc, stmt))
{
struct aop_joinpoint jp;
- init_joinpoint (&jp, &gsi, pc, stmt);
+ xloc = expand_location (gimple_location (stmt));
+ init_joinpoint (&jp, &gsi, pc, stmt, xloc.line, xloc.file);
cb (&jp, callback_param);
}
}
struct aop_joinpoint *jp = dv->jp;
stmt = gsi_stmt (*(jp->gsi));
-
+
/* If this function isn't on the right side of an assignment, we
need to _put it_ on the right hand side of an assignment so
we can grab its return value. */
tree new_lhs = create_tmp_var (gimple_call_return_type(stmt),
"aop_return");
gimple_call_set_lhs (stmt, new_lhs);
- update_stmt (stmt);
+ update_stmt (stmt);
}
return_value = stabilize_reference (gimple_call_lhs (stmt));
dv->type = pc->pc_call.return_type;
dv->jp = jp;
dv->get_dynval = op_get_return_value;
- return dv;
+ return dv;
}
/**
dv->type = type;
dv->jp = jp;
dv->get_dynval = op_get_return_value;
- return dv;
+ return dv;
}
static tree
/* Initializes a joinpoint with default values. */
void
init_joinpoint (struct aop_joinpoint *jp, gimple_stmt_iterator *gsi,
- struct aop_pointcut *pc, gimple stmt)
+ struct aop_pointcut *pc, gimple stmt, int line,
+ const char *file)
{
jp->pc = pc;
jp->gsi = gsi;
jp->stmt = stmt;
+ jp->line = line;
+ jp->file = file;
jp->is_prepared = false;
+
+}
+
+int
+aop_capture_lineno (struct aop_joinpoint *jp)
+{
+ return jp->line;
+}
+
+const char *
+aop_capture_file_name (struct aop_joinpoint *jp)
+{
+ return jp->file;
}
struct aop_pc_fun_call {
const char *function_name;
const struct aop_type *return_type;
- struct aop_param_desc *param_list_head;
+ struct aop_param_desc *param_list_head;
};
/* An AOP pointcut represents the a set of joinponts: locations in the
void (*join_on) (struct aop_pointcut *, join_callback, void *);
insert_callback insert_before;
insert_callback insert_after;
-
/* prepare_for_weave() gets called once for each joinpoint before
any advice gets inserted at that joinpoint. */
/* True if prepare_for_weave() has been called for this
joinpoint. */
bool is_prepared;
+ /* The line number corresponding to the joinpoint */
+ int line;
+ /* The file name corresponding to the joinpoint */
+ const char *file;
};
struct aop_pointcut *create_pointcut (enum aop_pckind kind);
void init_joinpoint (struct aop_joinpoint *jp, gimple_stmt_iterator *gsi,
- struct aop_pointcut *pc, gimple stmt);
+ struct aop_pointcut *pc, gimple stmt, int line,
+ const char *file);
void op_default_prepare_for_weave (struct aop_joinpoint *jp);
void op_default_insert_before (struct aop_joinpoint *jp, gimple stmt);
*/
extern int aop_capture_lhs_var_scope (struct aop_joinpoint *jp);
+
+extern int aop_capture_lineno (struct aop_joinpoint *jp);
+
+extern const char *aop_capture_file_name (struct aop_joinpoint *jp);
#endif