Merge "libsparse: fix building on linux host."
diff --git a/bootstat/Android.bp b/bootstat/Android.bp
index 6734f4d..2c87018 100644
--- a/bootstat/Android.bp
+++ b/bootstat/Android.bp
@@ -65,6 +65,11 @@
static_libs: ["libbootstat"],
shared_libs: ["liblogcat"],
init_rc: ["bootstat.rc"],
+ product_variables: {
+ debuggable: {
+ init_rc: ["bootstat-debug.rc"],
+ },
+ },
srcs: ["bootstat.cpp"],
}
diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh
index 5425fd3..7a45e4d 100755
--- a/bootstat/boot_reason_test.sh
+++ b/bootstat/boot_reason_test.sh
@@ -22,6 +22,8 @@
GREEN="${ESCAPE}[38;5;40m"
RED="${ESCAPE}[38;5;196m"
NORMAL="${ESCAPE}[0m"
+# Best guess to an average device's reboot time, refined as tests return
+DURATION_DEFAULT=45
# Helper functions
@@ -57,18 +59,45 @@
fi
}
-[ "USAGE: checkDebugBuild
+[ "USAGE: checkDebugBuild [--noerror]
Returns: true if device is a userdebug or eng release" ]
checkDebugBuild() {
if isDebuggable; then
echo "INFO: '${TEST}' test requires userdebug build"
+ elif [ -n "${1}" ]; then
+ echo "WARNING: '${TEST}' test requires userdebug build"
+ false
else
echo "ERROR: '${TEST}' test requires userdebug build, skipping FAILURE"
false
fi >&2
}
+[ "USAGE: setBootloaderBootReason [value]
+
+Returns: true if device supports and set boot reason injection" ]
+setBootloaderBootReason() {
+ inAdb || ( echo "ERROR: device not in adb mode." >&2 ; false ) || return 1
+ if [ -z "`adb shell ls /etc/init/bootstat-debug.rc 2>/dev/null`" ]; then
+ echo "ERROR: '${TEST}' test requires /etc/init/bootstat-debug.rc" >&2
+ return 1
+ fi
+ checkDebugBuild || return 1
+ if adb shell su root "cat /proc/cmdline | tr '\\0 ' '\\n\\n'" |
+ grep '^androidboot[.]bootreason=[^ ]' >/dev/null; then
+ echo "ERROR: '${TEST}' test requires a device with a bootloader that" >&2
+ echo " does not set androidboot.bootreason kernel parameter." >&2
+ return 1
+ fi
+ adb shell su root setprop persist.test.boot.reason "'${1}'" 2>/dev/null
+ test_reason="`adb shell getprop persist.test.boot.reason 2>/dev/null`"
+ if [ X"${test_reason}" != X"${1}" ]; then
+ echo "ERROR: can not set persist.test.boot.reason to '${1}'." >&2
+ return 1
+ fi
+}
+
[ "USAGE: enterPstore
Prints a warning string requiring functional pstore
@@ -204,7 +233,7 @@
return 0
}
-[ "USAGE: EXPECT_PROPERTY <prop> <value>
+[ "USAGE: EXPECT_PROPERTY <prop> <value> [--allow_failure]
Returns true if current return (regex) value is true and the result matches" ]
EXPECT_PROPERTY() {
@@ -214,6 +243,7 @@
shift 2
val=`adb shell getprop ${property} 2>&1`
EXPECT_EQ "${value}" "${val}" for Android property ${property} ||
+ [ -n "${1}" ] ||
save_ret=${?}
return ${save_ret}
}
@@ -253,6 +283,8 @@
bootstat: Battery level at shutdown 100%
bootstat: Battery level at startup 100%
init : Parsing file /system/etc/init/bootstat.rc...
+init : processing action (persist.test.boot.reason=*) from (/system/etc/init/bootstat-debug.rc:
+init : Command 'setprop ro.boot.bootreason \${persist.test.boot.reason}' action=persist.test.boot.reason=* (/system/etc/init/bootstat-debug.rc:
init : processing action (post-fs-data) from (/system/etc/init/bootstat.rc
init : processing action (boot) from (/system/etc/init/bootstat.rc
init : processing action (ro.boot.bootreason=*) from (/system/etc/init/bootstat.rc
@@ -279,11 +311,44 @@
Record start of test, preserve exit status" ]
start_test() {
save_ret=${?}
+ duration_prefix="~"
+ duration_estimate=1
START=`date +%s`
echo "${GREEN}[ RUN ]${NORMAL} ${TEST} ${*}"
return ${save_ret}
}
+duration_sum_diff=0
+duration_num=0
+[ "USAGE: duration_test [[prefix]seconds]
+
+Report the adjusted and expected test duration" ]
+duration_test() {
+ duration_prefix=${1%%[0123456789]*}
+ if [ -z "${duration_prefix}" ]; then
+ duration_prefix="~"
+ fi
+ duration_estimate="${1#${duration_prefix}}"
+ if [ -z "${duration_estimate}" ]; then
+ duration_estimate="${DURATION_DEFAULT}"
+ fi
+ duration_new_estimate="${duration_estimate}"
+ if [ 0 -ne ${duration_num} ]; then
+ duration_new_estimate=`expr ${duration_new_estimate} + \
+ \( ${duration_num} / 2 + ${duration_sum_diff} \) / ${duration_num}`
+ # guard against catastrophe
+ if [ -z "${duration_new_estimate}" ]; then
+ duration_new_estimate=${duration_estimate}
+ fi
+ fi
+ # negative values are so undignified
+ if [ 0 -ge ${duration_new_estimate} ]; then
+ duration_new_estimate=1
+ fi
+ echo "INFO: expected duration of '${TEST}' test" \
+ "${duration_prefix}`format_duration ${duration_new_estimate}`" >&2
+}
+
[ "USAGE: end_test [message]
Document duration and success of test, preserve exit status" ]
@@ -291,9 +356,16 @@
save_ret=${?}
END=`date +%s`
duration=`expr ${END} - ${START} 2>/dev/null`
- [ 0 = ${duration} ] ||
+ [ 0 -ge ${duration} ] ||
echo "INFO: '${TEST}' test duration `format_duration ${duration}`" >&2
if [ ${save_ret} = 0 ]; then
+ if [ 0 -lt ${duration} -a 0 -lt ${duration_estimate} -a \( \
+ X"~" = X"${duration_prefix}" -o \
+ ${duration_estimate} -gt ${duration} \) ]; then
+ duration_sum_diff=`expr ${duration_sum_diff} + \
+ ${duration} - ${duration_estimate}`
+ duration_num=`expr ${duration_num} + 1`
+ fi
echo "${GREEN}[ OK ]${NORMAL} ${TEST} ${*}"
else
echo "${RED}[ FAILED ]${NORMAL} ${TEST} ${*}"
@@ -315,37 +387,33 @@
end_test ${2}
}
-[ "USAGE: validate_property <property>
+[ "USAGE: validate_reason <value>
Check property for CTS compliance with our expectations. Return a cleansed
string representing what is acceptable.
-NB: must roughly match heuristics in system/core/bootstat/bootstat.cpp" ]
-validate_property() {
- var=`adb shell getprop ${1} 2>&1`
- var=`echo -n ${var} |
+NB: must also roughly match heuristics in system/core/bootstat/bootstat.cpp" ]
+validate_reason() {
+ var=`echo -n ${*} |
tr '[A-Z]' '[a-z]' |
tr ' \f\t\r\n' '_____'`
case ${var} in
- watchdog) ;;
- watchdog,?*) ;;
- kernel_panic) ;;
- kernel_panic,?*) ;;
- recovery) ;;
- recovery,?*) ;;
- bootloader) ;;
- bootloader,?*) ;;
- cold) ;;
- cold,?*) ;;
- hard) ;;
- hard,?*) ;;
- warm) ;;
- warm,?*) ;;
- shutdown) ;;
- shutdown,?*) ;;
- reboot) ;;
- reboot,?*) ;;
- # Aliases
+ watchdog | watchdog,?* ) ;;
+ kernel_panic | kernel_panic,?*) ;;
+ recovery | recovery,?*) ;;
+ bootloader | bootloader,?*) ;;
+ cold | cold,?*) ;;
+ hard | hard,?*) ;;
+ warm | warm,?*) ;;
+ shutdown | shutdown,?*) ;;
+ reboot,reboot | reboot,reboot,* ) var=${var#reboot,} ; var=${var%,} ;;
+ reboot,cold | reboot,cold,* ) var=${var#reboot,} ; var=${var%,} ;;
+ reboot,hard | reboot,hard,* ) var=${var#reboot,} ; var=${var%,} ;;
+ reboot,warm | reboot,warm,* ) var=${var#reboot,} ; var=${var%,} ;;
+ reboot,recovery | reboot,recovery,* ) var=${var#reboot,} ; var=${var%,} ;;
+ reboot,bootloader | reboot,bootloader,* ) var=${var#reboot,} ; var=${var%,} ;;
+ reboot | reboot,?*) ;;
+ # Aliases and Heuristics
*wdog* | *watchdog* ) var="watchdog" ;;
*powerkey* ) var="cold,powerkey" ;;
*panic* | *kernel_panic*) var="kernel_panic" ;;
@@ -353,12 +421,26 @@
*s3_wakeup*) var="warm,s3_wakeup" ;;
*hw_reset*) var="hard,hw_reset" ;;
*bootloader*) var="bootloader" ;;
- ?*) var="reboot,${var}" ;;
*) var="reboot" ;;
esac
echo ${var}
}
+[ "USAGE: validate_property <property>
+
+Check property for CTS compliance with our expectations. Return a cleansed
+string representing what is acceptable.
+
+NB: must also roughly match heuristics in system/core/bootstat/bootstat.cpp" ]
+validate_property() {
+ val="`adb shell getprop ${1} 2>&1`"
+ ret=`validate_reason "${val}"`
+ if [ "reboot" = "${ret}" ]; then
+ ret=`validate_reason "reboot,${val}"`
+ fi
+ echo ${ret}
+}
+
#
# Actual test frames
#
@@ -372,6 +454,7 @@
- adb shell getprop sys.boot.reason (system reason)
- NB: all should have a value that is compliant with our known set." ]
test_properties() {
+ duration_test 1
wait_for_screen
retval=0
check_set="ro.boot.bootreason persist.sys.boot.reason sys.boot.reason"
@@ -381,7 +464,7 @@
# ERROR: expected "reboot" got ""
# for Android property persist.sys.boot.reason
# following is mitigation for the persist.sys.boot.reason, skip it
- if [ "reboot,factory_reset" = `validate_property ro.boot_bootreason` ]; then
+ if [ "reboot,factory_reset" = "`validate_property ro.boot_bootreason`" ]; then
check_set="ro.boot.bootreason sys.boot.reason"
bootloader="bootloader"
fi
@@ -410,7 +493,7 @@
Decision to change the build itself rather than trick bootstat by
rummaging through its data files was made." ]
test_ota() {
- echo "INFO: expected duration of '${TEST}' test >`format_duration 300`" >&2
+ duration_test ">300"
echo " extended by build and flashing times" >&2
if [ -z "${TARGET_PRODUCT}" -o \
-z "${ANDROID_PRODUCT_OUT}" -o \
@@ -451,7 +534,7 @@
fast and fake (touch build_date on device to make it different)" ]
test_optional_ota() {
checkDebugBuild || return
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 45`" >&2
+ duration_test
adb shell su root touch /data/misc/bootstat/build_date >&2
adb reboot ota
wait_for_screen
@@ -472,11 +555,11 @@
as a means of checking sanity and any persistent side effect of the
other tests." ]
blind_reboot_test() {
+ duration_test
case ${TEST} in
bootloader | recovery | cold | hard | warm ) reason=${TEST} ;;
*) reason=reboot,${TEST} ;;
esac
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 45`" >&2
adb reboot ${TEST}
wait_for_screen
EXPECT_PROPERTY sys.boot.reason ${reason}
@@ -508,7 +591,7 @@
a _real_ factory_reset is too destructive to the device." ]
test_factory_reset() {
checkDebugBuild || return
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 45`" >&2
+ duration_test
adb shell su root rm /data/misc/bootstat/build_date >&2
adb reboot >&2
wait_for_screen
@@ -531,7 +614,7 @@
For realz, and disruptive" ]
test_optional_factory_reset() {
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 60`" >&2
+ duration_test 60
if ! inFastboot; then
adb reboot-bootloader
fi
@@ -585,7 +668,7 @@
- (replace set logd.kernel true to the above, and retry test)" ]
test_battery() {
checkDebugBuild || return
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 120`" >&2
+ duration_test 120
enterPstore
# Send it _many_ times to combat devices with flakey pstore
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z; do
@@ -626,7 +709,7 @@
- adb shell getprop sys.boot.reason
- NB: should report shutdown,battery" ]
test_optional_battery() {
- echo "INFO: expected duration of '${TEST}' test >`format_duration 60`" >&2
+ duration_test ">60"
echo " power on request" >&2
adb shell setprop sys.powerctl shutdown,battery
sleep 5
@@ -646,7 +729,7 @@
- adb shell getprop sys.boot.reason
- NB: should report shutdown,thermal,battery" ]
test_optional_battery_thermal() {
- echo "INFO: expected duration of '${TEST}' test >`format_duration 60`" >&2
+ duration_test ">60"
echo " power on request" >&2
adb shell setprop sys.powerctl shutdown,thermal,battery
sleep 5
@@ -678,7 +761,7 @@
- NB: should report kernel_panic,sysrq" ]
test_kernel_panic() {
checkDebugBuild || return
- echo "INFO: expected duration of '${TEST}' test >`format_duration 120`" >&2
+ duration_test ">90"
panic_msg="kernel_panic,sysrq"
enterPstore || panic_msg="\(kernel_panic,sysrq\|kernel_panic\)"
echo c | adb shell su root tee /proc/sysrq-trigger >/dev/null
@@ -709,7 +792,7 @@
- adb shell getprop sys.boot.reason
- NB: should report shutdown,thermal" ]
test_thermal_shutdown() {
- echo "INFO: expected duration of '${TEST}' test >`format_duration 60`" >&2
+ durtion_test ">60"
echo " power on request" >&2
adb shell setprop sys.powerctl shutdown,thermal
sleep 5
@@ -729,7 +812,7 @@
- adb shell getprop sys.boot.reason
- NB: should report shutdown,userrequested" ]
test_userrequested_shutdown() {
- echo "INFO: expected duration of '${TEST}' test >`format_duration 60`" >&2
+ duration_test ">60"
echo " power on request" >&2
adb shell setprop sys.powerctl shutdown,userrequested
sleep 5
@@ -748,7 +831,7 @@
- adb shell getprop sys.boot.reason
- NB: should report reboot,shell" ]
test_shell_reboot() {
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 45`" >&2
+ duration_test
adb shell reboot
wait_for_screen
EXPECT_PROPERTY sys.boot.reason reboot,shell
@@ -764,7 +847,7 @@
- adb shell getprop sys.boot.reason
- NB: should report reboot,adb" ]
test_adb_reboot() {
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 45`" >&2
+ duration_test
adb reboot
wait_for_screen
EXPECT_PROPERTY sys.boot.reason reboot,adb
@@ -781,17 +864,109 @@
- NB: should report reboot,its_just_so_hard
- NB: expect log \"... I bootstat: Unknown boot reason: reboot,its_just_so_hard\"" ]
test_Its_Just_So_Hard_reboot() {
- checkDebugBuild || return
- echo "INFO: expected duration of '${TEST}' test ~`format_duration 45`" >&2
+ duration_test
adb shell 'reboot "Its Just So Hard"'
wait_for_screen
EXPECT_PROPERTY sys.boot.reason reboot,its_just_so_hard
EXPECT_PROPERTY persist.sys.boot.reason "reboot,Its Just So Hard"
adb shell su root setprop persist.sys.boot.reason reboot,its_just_so_hard
- EXPECT_PROPERTY persist.sys.boot.reason reboot,its_just_so_hard
+ if checkDebugBuild; then
+ flag=""
+ else
+ flag="--allow_failure"
+ fi
+ EXPECT_PROPERTY persist.sys.boot.reason reboot,its_just_so_hard ${flag}
report_bootstat_logs reboot,its_just_so_hard
}
+[ "USAGE: run_bootloader [value [expected]]
+
+bootloader boot reason injection tests:
+- setBootloaderBootReason value
+- adb shell reboot
+- (wait until screen is up, boot has completed)
+- adb shell getprop sys.boot.reason
+- NB: should report reboot,value" ]
+run_bootloader() {
+ bootloader_expected="${1}"
+ if [ -z "${bootloader_expected}" ]; then
+ bootloader_expected="${TEST#bootloader_}"
+ fi
+ if ! setBootloaderBootReason ${bootloader_expected}; then
+ echo " Skipping FAILURE." 2>&1
+ return
+ fi
+ duration_test
+ if [ X"warm" = X"${bootloader_expected}" ]; then
+ last_expected=cold
+ else
+ last_expected=warm
+ fi
+ adb reboot ${last_expected}
+ wait_for_screen
+ # Reset so that other tests do not get unexpected injection
+ setBootloaderBootReason
+ # Determine the expected values
+ sys_expected="${2}"
+ if [ -z "${sys_expected}" ]; then
+ sys_expected="`validate_reason ${bootloader_expected}`"
+ if [ "reboot" = "${sys_expected}" ]; then
+ sys_expected="${last_expected}"
+ fi
+ else
+ sys_expected=`validate_reason ${sys_expected}`
+ fi
+ case ${sys_expected} in
+ kernel_panic | kernel_panic,* | watchdog | watchdog,* )
+ last_expected=${sys_expected}
+ ;;
+ esac
+ # Check values
+ EXPECT_PROPERTY ro.boot.bootreason "${bootloader_expected}"
+ EXPECT_PROPERTY sys.boot.reason "${sys_expected}"
+ EXPECT_PROPERTY persist.sys.boot.reason "${last_expected}"
+ report_bootstat_logs "${sys_expected}"
+}
+
+[ "USAGE: test_bootloader_<type>
+
+bootloader boot reasons test injection" ]
+test_bootloader_normal() {
+ run_bootloader
+}
+
+test_bootloader_watchdog() {
+ run_bootloader
+}
+
+test_bootloader_kernel_panic() {
+ run_bootloader
+}
+
+test_bootloader_oem_powerkey() {
+ run_bootloader
+}
+
+test_bootloader_wdog_reset() {
+ run_bootloader
+}
+
+test_bootloader_cold() {
+ run_bootloader
+}
+
+test_bootloader_warm() {
+ run_bootloader
+}
+
+test_bootloader_hard() {
+ run_bootloader
+}
+
+test_bootloader_recovery() {
+ run_bootloader
+}
+
[ "USAGE: ${0##*/} [-s SERIAL] [tests]
Mainline executive to run the above tests" ]
@@ -842,8 +1017,13 @@
grep -v '^optional_'`
if [ -z "${2}" ]; then
# Hard coded should shell fail to find them above (search/permission issues)
- eval set ota cold factory_reset hard battery unknown kernel_panic warm \
- thermal_shutdown userrequested_shutdown shell_reboot adb_reboot
+ eval set properties ota cold factory_reset hard battery unknown \
+ kernel_panic warm thermal_shutdown userrequested_shutdown \
+ shell_reboot adb_reboot Its_Just_So_Hard_reboot \
+ bootloader_normal bootloader_watchdog bootloader_kernel_panic \
+ bootloader_oem_powerkey bootloader_wdog_reset \
+ bootloader_wdog_reset bootloader_wdog_reset bootloader_hard \
+ bootloader_recovery
fi
if [ X"nothing" = X"${1}" ]; then
shift 1
@@ -851,6 +1031,9 @@
fi
echo "INFO: selected test(s): ${@}" >&2
echo
+# Prepare device
+setBootloaderBootReason 2>/dev/null
+# Start pouring through the tests.
failures=
successes=
for t in "${@}"; do
diff --git a/bootstat/bootstat-debug.rc b/bootstat/bootstat-debug.rc
new file mode 100644
index 0000000..6a00440
--- /dev/null
+++ b/bootstat/bootstat-debug.rc
@@ -0,0 +1,7 @@
+# This file is the userdebug LOCAL_INIT_RC file for the bootstat command.
+
+# FOR TESTING
+# For devices w/o bootloader boot reason reported, mirror test boot reason
+# to bootloader boot reason to allow test to inject reasons
+on property:persist.test.boot.reason=*
+ setprop ro.boot.bootreason ${persist.test.boot.reason}
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 1954966..f8eaa1c 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -129,6 +129,7 @@
property_set(key, val);
}
+constexpr int32_t kEmptyBootReason = 0;
constexpr int32_t kUnknownBootReason = 1;
// A mapping from boot reason string, as read from the ro.boot.bootreason
@@ -136,6 +137,7 @@
// the boot_reason metric may refer to this mapping to discern the histogram
// values.
const std::map<std::string, int32_t> kBootReasonMap = {
+ {"empty", kEmptyBootReason},
{"unknown", kUnknownBootReason},
{"normal", 2},
{"recovery", 3},
@@ -205,6 +207,11 @@
{"reboot,adb", 67},
{"reboot,userrequested", 68},
{"shutdown,container", 69}, // Host OS asking Android Container to shutdown
+ {"cold,powerkey", 70},
+ {"warm,s3_wakeup", 71},
+ {"hard,hw_reset", 72},
+ {"shutdown,suspend", 73}, // Suspend to RAM
+ {"shutdown,hibernate", 74}, // Suspend to DISK
};
// Converts a string value representing the reason the system booted to an
@@ -216,6 +223,10 @@
return mapping->second;
}
+ if (boot_reason.empty()) {
+ return kEmptyBootReason;
+ }
+
LOG(INFO) << "Unknown boot reason: " << boot_reason;
return kUnknownBootReason;
}
@@ -747,8 +758,16 @@
// property.
void RecordBootReason() {
const std::string reason(GetProperty(bootloader_reboot_reason_property));
- android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT,
- android::metricslogger::FIELD_PLATFORM_REASON, reason);
+
+ if (reason.empty()) {
+ // Log an empty boot reason value as '<EMPTY>' to ensure the value is intentional
+ // (and not corruption anywhere else in the reporting pipeline).
+ android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT,
+ android::metricslogger::FIELD_PLATFORM_REASON, "<EMPTY>");
+ } else {
+ android::metricslogger::LogMultiAction(android::metricslogger::ACTION_BOOT,
+ android::metricslogger::FIELD_PLATFORM_REASON, reason);
+ }
// Log the raw bootloader_boot_reason property value.
int32_t boot_reason = BootReasonStrToEnum(reason);
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index dbf81a4..45e768d 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -19,6 +19,7 @@
#include <sys/capability.h>
#include <sys/prctl.h>
#include <sys/ptrace.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/demangle/DemangleTest.cpp b/demangle/DemangleTest.cpp
index f56a9be..c93e2ab 100644
--- a/demangle/DemangleTest.cpp
+++ b/demangle/DemangleTest.cpp
@@ -428,6 +428,14 @@
ASSERT_EQ("_ZN3one3twoEDa", demangler.Parse("_ZN3one3twoEDa", 12));
}
+TEST(DemangleTest, BooleanLiterals) {
+ Demangler demangler;
+
+ ASSERT_EQ("one<true>", demangler.Parse("_ZN3oneILb1EEE"));
+ ASSERT_EQ("one<false>", demangler.Parse("_ZN3oneILb0EEE"));
+ ASSERT_EQ("one<false, true>", demangler.Parse("_ZN3oneILb0ELb1EEE"));
+}
+
TEST(DemangleTest, demangle) {
std::string str;
diff --git a/demangle/Demangler.cpp b/demangle/Demangler.cpp
index c0a96aa..f148b21 100644
--- a/demangle/Demangler.cpp
+++ b/demangle/Demangler.cpp
@@ -660,6 +660,29 @@
return nullptr;
}
+const char* Demangler::ParseTemplateLiteral(const char* name) {
+ if (*name == 'E') {
+ parse_func_ = parse_funcs_.back();
+ parse_funcs_.pop_back();
+ return name + 1;
+ }
+ // Only understand boolean values with 0 or 1.
+ if (*name == 'b') {
+ name++;
+ if (*name == '0') {
+ AppendArgument("false");
+ cur_state_.str.clear();
+ } else if (*name == '1') {
+ AppendArgument("true");
+ cur_state_.str.clear();
+ } else {
+ return nullptr;
+ }
+ return name + 1;
+ }
+ return nullptr;
+}
+
const char* Demangler::ParseTemplateArgumentsComplex(const char* name) {
if (*name == 'E') {
if (parse_funcs_.empty()) {
@@ -670,6 +693,11 @@
FinalizeTemplate();
Save(cur_state_.str, false);
return name + 1;
+ } else if (*name == 'L') {
+ // Literal value for a template.
+ parse_funcs_.push_back(parse_func_);
+ parse_func_ = &Demangler::ParseTemplateLiteral;
+ return name + 1;
}
return ParseArguments(name);
}
diff --git a/demangle/Demangler.h b/demangle/Demangler.h
index 3bd4f3c..f76def6 100644
--- a/demangle/Demangler.h
+++ b/demangle/Demangler.h
@@ -92,6 +92,7 @@
const char* ParseArguments(const char* name);
const char* ParseTemplateArguments(const char* name);
const char* ParseTemplateArgumentsComplex(const char* name);
+ const char* ParseTemplateLiteral(const char* name);
const char* ParseFunctionArgument(const char* name);
const char* ParseFunctionName(const char* name);
const char* FindFunctionName(const char* name);
diff --git a/rootdir/init.rc b/rootdir/init.rc
index fb1fbd4..d503ffe 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -721,6 +721,7 @@
user shell
group shell log readproc
seclabel u:r:shell:s0
+ setenv HOSTNAME console
on property:ro.debuggable=1
# Give writes to anyone for the trace folder on debug builds.
diff --git a/trusty/nvram/trusty_nvram_device.cpp b/trusty/nvram/trusty_nvram_device.cpp
index 2c50915..82a1228 100644
--- a/trusty/nvram/trusty_nvram_device.cpp
+++ b/trusty/nvram/trusty_nvram_device.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <errno.h>
+
#include <nvram/hal/nvram_device_adapter.h>
#include "trusty_nvram_implementation.h"