Skip to content

Commit 6f2783d

Browse files
committed
Add various debug statements to trans that I used to help track down the
problem and which seem like they could be useful in the future.
1 parent e11d13f commit 6f2783d

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,15 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
15791579
id: ast::node_id,
15801580
impl_id: Option<ast::def_id>,
15811581
param_substs: Option<@param_substs>,
1582-
sp: Option<span>) -> fn_ctxt {
1582+
sp: Option<span>) -> fn_ctxt
1583+
{
1584+
debug!("new_fn_ctxt_w_id(path=%s, id=%?, impl_id=%?, \
1585+
param_substs=%s",
1586+
path_str(ccx.sess, path),
1587+
id,
1588+
impl_id,
1589+
opt_param_substs_to_str(ccx.tcx, &param_substs));
1590+
15831591
let llbbs = mk_standard_basic_blocks(llfndecl);
15841592
return @mut fn_ctxt_ {
15851593
llfn: llfndecl,

src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn trans_fn_ref_with_vtables(
217217
// - `type_params`: values for each of the fn/method's type parameters
218218
// - `vtables`: values for each bound on each of the type parameters
219219

220-
let _icx = bcx.insn_ctxt("trans_fn_with_vtables");
220+
let _icx = bcx.insn_ctxt("trans_fn_ref_with_vtables");
221221
let ccx = bcx.ccx();
222222
let tcx = ccx.tcx;
223223

src/librustc/middle/trans/common.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ pub fn param_substs_to_str(tcx: ty::ctxt, substs: &param_substs) -> ~str {
257257
substs.bounds.map(|b| ty::param_bounds_to_str(tcx, *b)))
258258
}
259259

260+
pub fn opt_param_substs_to_str(tcx: ty::ctxt,
261+
substs: &Option<@param_substs>) -> ~str {
262+
substs.map_default(~"None", |&ps| param_substs_to_str(tcx, ps))
263+
}
264+
260265
// Function context. Every LLVM function we create will have one of
261266
// these.
262267
pub struct fn_ctxt_ {
@@ -1423,7 +1428,7 @@ pub fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, +vt: typeck::vtable_origin)
14231428
}
14241429
14251430
pub fn find_vtable(tcx: ty::ctxt, ps: &param_substs,
1426-
n_param: uint, n_bound: uint)
1431+
n_param: uint, n_bound: uint)
14271432
-> typeck::vtable_origin {
14281433
debug!("find_vtable_in_fn_ctxt(n_param=%u, n_bound=%u, ps=%?)",
14291434
n_param, n_bound, param_substs_to_str(tcx, ps));

src/librustc/middle/trans/meth.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ pub fn trans_method_callee(bcx: block,
175175
-> Callee {
176176
let _icx = bcx.insn_ctxt("impl::trans_method_callee");
177177
178+
debug!("trans_method_callee(callee_id=%?, self=%s, mentry=%?)",
179+
callee_id, bcx.expr_to_str(self), mentry);
180+
178181
// Replace method_self with method_static here.
179182
let mut origin = mentry.origin;
180183
match origin {
@@ -218,6 +221,8 @@ pub fn trans_method_callee(bcx: block,
218221
typeck::method_trait(*) => {}
219222
}
220223
224+
debug!("origin=%?", origin);
225+
221226
match origin {
222227
typeck::method_static(did) => {
223228
let callee_fn = callee::trans_fn_ref(bcx, did, callee_id);

src/librustc/middle/trans/monomorphize.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ pub fn monomorphic_fn(ccx: @CrateContext,
6767
must_cast = true;
6868
}
6969

70-
debug!("monomorphic_fn(fn_id=%? (%s), real_substs=%?, substs=%?, \
71-
hash_id = %?",
70+
debug!("monomorphic_fn(fn_id=%? (%s), vtables=%?, \
71+
real_substs=%?, substs=%?, \
72+
hash_id = %?",
7273
fn_id, ty::item_path_str(ccx.tcx, fn_id),
74+
vtables,
7375
real_substs.map(|s| ty_to_str(ccx.tcx, *s)),
7476
substs.map(|s| ty_to_str(ccx.tcx, *s)), hash_id);
7577

0 commit comments

Comments
 (0)