aboutsummaryrefslogtreecommitdiff
path: root/src/comp/driver
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-04-07 20:20:57 +0200
committerGraydon Hoare <[email protected]>2011-04-07 14:19:19 -0700
commit39774e88b42409c3a432a8426cfef253f67d7709 (patch)
tree31e390c973e7ccdc8bf88eddf5f7f45e122621b2 /src/comp/driver
parentFix problem in metadata writer (diff)
downloadrust-39774e88b42409c3a432a8426cfef253f67d7709.tar.xz
rust-39774e88b42409c3a432a8426cfef253f67d7709.zip
Add a very basic crate-dump utility
'rustc -ls [cratelib]' will now dump out a list of symbols defined by the crate, as well as a short description of what they are.
Diffstat (limited to 'src/comp/driver')
-rw-r--r--src/comp/driver/rustc.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index 36827b73..928c934a 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -98,6 +98,7 @@ fn usage(session.session sess, str argv0) {
log " -glue generate glue.bc file";
log " -shared compile a shared-library crate";
log " -pp pretty-print the input instead of compiling";
+ log " -ls list the symbols defined by a crate file";
log " -L <path> add a directory to the library search path";
log " -h display this message";
log "";
@@ -130,6 +131,7 @@ impure fn main(vec[str] args) {
let bool do_warn = true;
let bool shared = false;
let bool pretty = false;
+ let bool ls = false;
let bool glue = false;
// FIXME: Maybe we should support -O0, -O1, -Os, etc
@@ -152,6 +154,8 @@ impure fn main(vec[str] args) {
shared = true;
} else if (_str.eq(arg, "-pp")) {
pretty = true;
+ } else if (_str.eq(arg, "-ls")) {
+ ls = true;
} else if (_str.eq(arg, "-o")) {
if (i+1u < len) {
output_file = some(args.(i+1u));
@@ -214,8 +218,9 @@ impure fn main(vec[str] args) {
auto env = default_environment(sess, args.(0), ifile);
if (pretty) {
pretty_print_input(sess, env, ifile);
- }
- else {
+ } else if (ls) {
+ front.creader.list_file_metadata(ifile, std.io.stdout());
+ } else {
alt (output_file) {
case (none[str]) {
let vec[str] parts = _str.split(ifile, '.' as u8);