Skip to content

Commit df93cfa

Browse files
committed
---
yaml --- r: 12028 b: refs/heads/master c: 8142438 h: refs/heads/master v: v3
1 parent d623e4d commit df93cfa

File tree

10 files changed

+66
-53
lines changed

10 files changed

+66
-53
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c8ab0c1b3b2b6af4e9efa96773926bfa2f58f016
2+
refs/heads/master: 81424389382316220944322305c9935119dba5ce
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
114114
STDLIB_GLOB :=$(call CFG_LIB_GLOB,std)
115115
CORELIB_GLOB :=$(call CFG_LIB_GLOB,core)
116116
LIBRUSTC_GLOB :=$(call CFG_LIB_GLOB,rustc)
117+
STDLIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,std)
118+
CORELIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,core)
119+
LIBRUSTC_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustc)
117120

118121
# version-string calculation
119122
CFG_GIT_DIR := $(CFG_SRC_DIR).git

trunk/mk/host.mk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC): \
3131
$$(HSTDLIB_DEFAULT$(2)_H_$(3))
3232
@$$(call E, cp: $$@)
3333
$$(Q)cp $$< $$@
34-
$$(Q)cp $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_GLOB) \
34+
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_GLOB) \
35+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_DSYM_GLOB) \
3536
$$(HLIB$(2)_H_$(4))
3637

3738
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME): \
@@ -44,7 +45,8 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB): \
4445
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
4546
@$$(call E, cp: $$@)
4647
$$(Q)cp $$< $$@
47-
$$(Q)cp $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_GLOB) \
48+
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_GLOB) \
49+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_DSYM_GLOB) \
4850
$$(HLIB$(2)_H_$(4))
4951

5052
$$(HLIB$(2)_H_$(4))/$$(CFG_STDLIB): \
@@ -53,7 +55,8 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_STDLIB): \
5355
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
5456
@$$(call E, cp: $$@)
5557
$$(Q)cp $$< $$@
56-
$$(Q)cp $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB) \
58+
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB) \
59+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_DSYM_GLOB) \
5760
$$(HLIB$(2)_H_$(4))
5861

5962
$$(HLIB$(2)_H_$(4))/libcore.rlib: \

trunk/mk/platform.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ endif
8585
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
8686
CFG_LIB_NAME=lib$(1).dylib
8787
CFG_LIB_GLOB=lib$(1)-*.dylib
88+
CFG_LIB_DSYM_GLOB=lib$(1)-*.dylib.dSYM
8889
CFG_UNIXY := 1
8990
CFG_LDENV := DYLD_LIBRARY_PATH
9091
CFG_GCCISH_LINK_FLAGS += -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind

trunk/src/rustc/driver/driver.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,19 +449,18 @@ fn build_session_options(match: getopts::match,
449449
ret sopts;
450450
}
451451

452-
fn build_session(sopts: @session::options, input: str,
452+
fn build_session(sopts: @session::options,
453453
demitter: diagnostic::emitter) -> session {
454454
let codemap = codemap::new_codemap();
455455
let diagnostic_handler =
456456
diagnostic::mk_handler(some(demitter));
457457
let span_diagnostic_handler =
458458
diagnostic::mk_span_handler(diagnostic_handler, codemap);
459-
build_session_(sopts, input, codemap, demitter,
460-
span_diagnostic_handler)
459+
build_session_(sopts, codemap, demitter, span_diagnostic_handler)
461460
}
462461

463462
fn build_session_(
464-
sopts: @session::options, input: str,
463+
sopts: @session::options,
465464
codemap: codemap::codemap,
466465
demitter: diagnostic::emitter,
467466
span_diagnostic_handler: diagnostic::span_handler
@@ -488,7 +487,7 @@ fn build_session_(
488487
span_diagnostic: span_diagnostic_handler,
489488
filesearch: filesearch,
490489
mutable building_library: false,
491-
working_dir: path::dirname(input)}
490+
working_dir: os::getcwd()}
492491
}
493492

494493
fn parse_pretty(sess: session, &&name: str) -> pp_mode {
@@ -636,7 +635,7 @@ mod test {
636635
getopts::fail_str(f); }
637636
};
638637
let sessopts = build_session_options(match, diagnostic::emit);
639-
let sess = build_session(sessopts, "", diagnostic::emit);
638+
let sess = build_session(sessopts, diagnostic::emit);
640639
let cfg = build_configuration(sess, "whatever", "whatever");
641640
assert (attr::contains_name(cfg, "test"));
642641
}
@@ -652,7 +651,7 @@ mod test {
652651
getopts::fail_str(f); }
653652
};
654653
let sessopts = build_session_options(match, diagnostic::emit);
655-
let sess = build_session(sessopts, "", diagnostic::emit);
654+
let sess = build_session(sessopts, diagnostic::emit);
656655
let cfg = build_configuration(sess, "whatever", "whatever");
657656
let test_items = attr::find_meta_items_by_name(cfg, "test");
658657
assert (vec::len(test_items) == 1u);

trunk/src/rustc/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn run_compiler(args: [str], demitter: diagnostic::emitter) {
9999
};
100100

101101
let sopts = build_session_options(match, demitter);
102-
let sess = build_session(sopts, ifile, demitter);
102+
let sess = build_session(sopts, demitter);
103103
let odir = getopts::opt_maybe_str(match, "out-dir");
104104
let ofile = getopts::opt_maybe_str(match, "o");
105105
let cfg = build_configuration(sess, binary, ifile);

trunk/src/rustc/middle/trans/base.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info {
402402
llsize = llsize_of(ccx, llty);
403403
llalign = llalign_of(ccx, llty);
404404
let name;
405-
if ccx.sess.opts.debuginfo {
405+
if false /*ccx.sess.opts.debuginfo*/ { //XXX this triggers duplicate LLVM symbols
406406
name = mangle_internal_name_by_type_only(ccx, t, "tydesc");
407407
} else { name = mangle_internal_name_by_seq(ccx, "tydesc"); }
408408
note_unique_llvm_symbol(ccx, name);
@@ -427,7 +427,7 @@ fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef,
427427
name: str) -> ValueRef {
428428
let name = name;
429429
let fn_nm;
430-
if ccx.sess.opts.debuginfo {
430+
if false /*ccx.sess.opts.debuginfo*/ { //XXX this triggers duplicate LLVM symbols
431431
fn_nm = mangle_internal_name_by_type_only(ccx, t, "glue_" + name);
432432
} else {
433433
fn_nm = mangle_internal_name_by_seq(ccx, "glue_" + name);
@@ -4672,8 +4672,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
46724672
lib::llvm::associate_type(tn, "tydesc", tydesc_type);
46734673
let crate_map = decl_crate_map(sess, link_meta.name, llmod);
46744674
let dbg_cx = if sess.opts.debuginfo {
4675-
option::some(@{llmetadata: map::int_hash(),
4676-
names: new_namegen()})
4675+
option::some(debuginfo::mk_ctxt(llmod_id))
46774676
} else {
46784677
option::none
46794678
};

trunk/src/rustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ type crate_ctxt = {
114114
builder: BuilderRef_res,
115115
shape_cx: shape::ctxt,
116116
crate_map: ValueRef,
117-
dbg_cx: option<@debuginfo::debug_ctxt>,
117+
dbg_cx: option<debuginfo::debug_ctxt>,
118118
mutable do_not_commit_warning_issued: bool};
119119

120120
// Types used for llself.

trunk/src/rustc/middle/trans/debuginfo.rs

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import std::map;
12
import std::map::hashmap;
23
import lib::llvm::llvm;
34
import lib::llvm::ValueRef;
@@ -17,6 +18,7 @@ export create_function;
1718
export create_arg;
1819
export update_source_pos;
1920
export debug_ctxt;
21+
export mk_ctxt;
2022

2123
const LLVMDebugVersion: int = (9 << 16);
2224

@@ -75,18 +77,24 @@ fn llnull() -> ValueRef unsafe {
7577

7678
fn add_named_metadata(cx: @crate_ctxt, name: str, val: ValueRef) {
7779
str::as_c_str(name, {|sbuf|
78-
llvm::LLVMAddNamedMetadataOperand(cx.llmod, sbuf,
79-
val)
80+
llvm::LLVMAddNamedMetadataOperand(cx.llmod, sbuf, val)
8081
})
8182
}
8283

8384
////////////////
8485

8586
type debug_ctxt = {
8687
llmetadata: metadata_cache,
87-
names: namegen
88+
names: namegen,
89+
crate_file: str
8890
};
8991

92+
fn mk_ctxt(crate: str) -> debug_ctxt {
93+
{llmetadata: map::int_hash(),
94+
names: new_namegen(),
95+
crate_file: crate}
96+
}
97+
9098
fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
9199
let existing = if cache.contains_key(mdtag) {
92100
cache.get(mdtag)
@@ -99,7 +107,7 @@ fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
99107
type metadata<T> = {node: ValueRef, data: T};
100108

101109
type file_md = {path: str};
102-
type compile_unit_md = {path: str};
110+
type compile_unit_md = {name: str};
103111
type subprogram_md = {id: ast::node_id};
104112
type local_var_md = {id: ast::node_id};
105113
type tydesc_md = {hash: uint};
@@ -154,48 +162,51 @@ fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int,
154162
ret option::none;
155163
}
156164

157-
fn create_compile_unit(cx: @crate_ctxt, full_path: str)
165+
fn create_compile_unit(cx: @crate_ctxt)
158166
-> @metadata<compile_unit_md> unsafe {
159167
let cache = get_cache(cx);
168+
let crate_name = option::get(cx.dbg_cx).crate_file;
160169
let tg = CompileUnitTag;
161170
alt cached_metadata::<@metadata<compile_unit_md>>(cache, tg,
162-
{|md| md.data.path == full_path}) {
171+
{|md| md.data.name == crate_name}) {
163172
option::some(md) { ret md; }
164173
option::none {}
165174
}
166175

167-
let work_dir = cx.sess.working_dir;
168-
let file_path = if str::starts_with(full_path, work_dir) {
169-
str::slice(full_path, str::len(work_dir), str::len(full_path))
170-
} else {
171-
full_path
172-
};
176+
let (_, work_dir) = get_file_path_and_dir(cx.sess.working_dir,
177+
crate_name);
173178
let unit_metadata = [lltag(tg),
174179
llunused(),
175180
lli32(DW_LANG_RUST),
176-
llstr(file_path),
181+
llstr(crate_name),
177182
llstr(work_dir),
178183
llstr(#env["CFG_VERSION"]),
179-
lli1(false), // main compile unit
184+
lli1(true), // deprecated: main compile unit
180185
lli1(cx.sess.opts.optimize != 0u),
181186
llstr(""), // flags (???)
182187
lli32(0) // runtime version (???)
183-
// list of enum types
184-
// list of retained values
185-
// list of subprograms
186-
// list of global variables
187188
];
188189
let unit_node = llmdnode(unit_metadata);
189190
add_named_metadata(cx, "llvm.dbg.cu", unit_node);
190-
let mdval = @{node: unit_node, data: {path: full_path}};
191+
let mdval = @{node: unit_node, data: {name: crate_name}};
191192
update_cache(cache, tg, compile_unit_metadata(mdval));
193+
192194
ret mdval;
193195
}
194196

195197
fn get_cache(cx: @crate_ctxt) -> metadata_cache {
196198
option::get(cx.dbg_cx).llmetadata
197199
}
198200

201+
fn get_file_path_and_dir(work_dir: str, full_path: str) -> (str, str) {
202+
(if str::starts_with(full_path, work_dir) {
203+
str::slice(full_path, str::len(work_dir) + 1u,
204+
str::len(full_path))
205+
} else {
206+
full_path
207+
}, work_dir)
208+
}
209+
199210
fn create_file(cx: @crate_ctxt, full_path: str) -> @metadata<file_md> {
200211
let cache = get_cache(cx);;
201212
let tg = FileDescriptorTag;
@@ -205,12 +216,12 @@ fn create_file(cx: @crate_ctxt, full_path: str) -> @metadata<file_md> {
205216
option::none {}
206217
}
207218

208-
let fname = path::basename(full_path);
209-
let path = path::dirname(full_path);
210-
let unit_node = create_compile_unit(cx, full_path).node;
219+
let (file_path, work_dir) = get_file_path_and_dir(cx.sess.working_dir,
220+
full_path);
221+
let unit_node = create_compile_unit(cx).node;
211222
let file_md = [lltag(tg),
212-
llstr(fname),
213-
llstr(path),
223+
llstr(file_path),
224+
llstr(work_dir),
214225
unit_node];
215226
let val = llmdnode(file_md);
216227
let mdval = @{node: val, data: {path: full_path}};
@@ -310,7 +321,7 @@ fn create_basic_type(cx: @crate_ctxt, t: ty::t, ty: ast::prim_ty, span: span)
310321

311322
let fname = filename_from_span(cx, span);
312323
let file_node = create_file(cx, fname);
313-
let cu_node = create_compile_unit(cx, fname);
324+
let cu_node = create_compile_unit(cx);
314325
let (size, align) = size_and_align_of(cx, t);
315326
let lldata = [lltag(tg),
316327
cu_node.node,
@@ -463,7 +474,7 @@ fn create_composite_type(type_tag: int, name: str, file: ValueRef, line: int,
463474
lli32(line), // source line definition
464475
lli64(size), // size of members
465476
lli64(align), // align
466-
lli64(offset), // offset
477+
lli32/*64*/(offset), // offset
467478
lli32(0), // flags
468479
if option::is_none(derived) {
469480
llnull()
@@ -781,13 +792,9 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
781792
option::none {}
782793
}
783794

784-
let path = path_str(fcx.path);
785-
786795
let loc = codemap::lookup_char_pos(cx.sess.codemap,
787796
sp.lo);
788797
let file_node = create_file(cx, loc.file.name).node;
789-
let key = if cx.item_symbols.contains_key(fcx.id) { fcx.id } else { id };
790-
let mangled = cx.item_symbols.get(key);
791798
let ty_node = if cx.sess.opts.extra_debuginfo {
792799
alt ret_ty.node {
793800
ast::ty_nil { llnull() }
@@ -804,17 +811,17 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
804811
llunused(),
805812
file_node,
806813
llstr(ident),
807-
llstr(path), //XXX fully-qualified C++ name
808-
llstr(mangled), //XXX MIPS name?????
814+
llstr(ident), //XXX fully-qualified C++ name
815+
llstr(""), //XXX MIPS name?????
809816
file_node,
810817
lli32(loc.line as int),
811818
sub_node,
812819
lli1(false), //XXX static (check export)
813-
lli1(true), // not extern
820+
lli1(true), // defined in compilation unit
814821
lli32(DW_VIRTUALITY_none), // virtual-ness
815822
lli32(0i), //index into virt func
816-
llnull(), // base type with vtbl
817-
lli1(false), // artificial
823+
/*llnull()*/ lli32(0), // base type with vtbl
824+
lli32(256), // flags
818825
lli1(cx.sess.opts.optimize != 0u),
819826
fcx.llfn
820827
//list of template params
@@ -825,5 +832,6 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
825832
add_named_metadata(cx, "llvm.dbg.sp", val);
826833
let mdval = @{node: val, data: {id: id}};
827834
update_cache(cache, SubprogramTag, subprogram_metadata(mdval));
835+
828836
ret mdval;
829837
}

trunk/src/rustdoc/astsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ fn build_session() -> (session::session, @mutable bool) {
155155
let error_handlers = build_error_handlers(codemap);
156156
let {emitter, span_handler, ignore_errors} = error_handlers;
157157

158-
let session = driver::build_session_(sopts, ".", codemap, emitter,
158+
let session = driver::build_session_(sopts, codemap, emitter,
159159
span_handler);
160160
(session, ignore_errors)
161161
}

0 commit comments

Comments
 (0)