#!/bin/sh
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

# Exit if anything fails
set -e

lldb=lldb-7

# Prepare commands that will be loaded before any file on the command line has been loaded
script_import="command script import \"/usr/share/rust-lldb/lldb_rust_formatters.py\""
category_definition="type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust"
category_enable="type category enable Rust"

# Call LLDB with the commands added to the argument list
exec "$lldb" --one-line-before-file="$script_import" \
    --one-line-before-file="$category_definition" \
    --one-line-before-file="$category_enable" \
    "$@"
