pub fn create(options: &RecordCommand) -> SessionSharedPtr {
        // The syscallbuf library interposes some critical
        // external symbols like XShmQueryExtension(), so we
        // preload it whether or not syscallbuf is enabled. Indicate here whether
        // syscallbuf is enabled.
        if options.use_syscall_buffer == SyscallBuffering::DisableSyscallBuf {
            env::remove_var(SYSCALLBUF_ENABLED_ENV_VAR);
        } else {
            env::set_var(SYSCALLBUF_ENABLED_ENV_VAR, "1");
            check_perf_event_paranoid();
        }

        let mut env: Vec<(OsString, OsString)> = env::vars_os().collect();
        env.extend_from_slice(&options.extra_env);

        let full_path = lookup_by_path(&options.args[0]);
        let exe_info: ExeInfo = read_exe_info(&full_path);

        // LD_PRELOAD the syscall interception lib
        let maybe_syscall_buffer_lib_path = find_helper_library(SYSCALLBUF_LIB_FILENAME);
        match maybe_syscall_buffer_lib_path {
            Some(syscall_buffer_lib_path) => {
                let mut ld_preload = Vec::<u8>::new();
                match &exe_info.libasan_path {
                    Some(asan_path) => {
                        log!(LogDebug, "Prepending {:?} to LD_PRELOAD", asan_path);
                        // Put an LD_PRELOAD entry for it before our preload library, because
                        // it checks that it's loaded first
                        ld_preload.extend_from_slice(asan_path.as_bytes());
                        ld_preload.push(b':');
                    }
                    None => (),
                }

                ld_preload.extend_from_slice(syscall_buffer_lib_path.as_bytes());
                ld_preload.extend_from_slice(SYSCALLBUF_LIB_FILENAME_PADDED.as_bytes());
                inject_ld_helper_library(&mut env, &OsStr::new("LD_PRELOAD"), ld_preload);
            }
            None => (),
        }

        env.push(("RUNNING_UNDER_RD".into(), "1".into()));
        // Stop Mesa using the GPU
        env.push(("LIBGL_ALWAYS_SOFTWARE".into(), "1".into()));
        // Stop sssd from using shared-memory with its daemon
        env.push(("SSS_NSS_USE_MEMCACHE".into(), "NO".into()));

        // Disable Gecko's "wait for gdb to attach on process crash" behavior, since
        // it is useless when running under rr.
        env.push(("MOZ_GDB_SLEEP".into(), "0".into()));

        // If we have CPUID faulting, don't use these environment hacks. We don't
        // need them and the user might want to use them themselves for other reasons.
        if !SessionInner::has_cpuid_faulting() {
            // OpenSSL uses RDRAND, but we can disable it. These bitmasks are inverted
            // and ANDed with the results of CPUID. The number below is 2^62, which is the
            // bit for RDRAND support.
            env.push(("OPENSSL_ia32cap".into(), "~4611686018427387904:~0".into()));
            // Disable Qt's use of RDRAND/RDSEED/RTM
            env.push(("QT_NO_CPU_FEATURE".into(), "rdrand rdseed rtm".into()));
        }

        RecordSession::new(
            &full_path,
            &env,
            options,
            exe_info.has_asan_symbols || exe_info.libasan_path.is_some(),
        )
    }
/// Create a recording session for the initial command line argv.
///
/// DIFF NOTE: Param list very different from rr.
/// Takes the whole &RecordCommand for simplicity.
Create a recording session for the initial command line argv.
DIFF NOTE: Param list very different from rr.
Takes the whole &RecordCommand for simplicity.
Create a recording session for the initial command line argv . DIFF NOTE : Param list very different from rr . Takes the whole &RecordCommand for simplicity .
pub fn create(options: &RecordCommand) -> SessionSharedPtr {
        // The syscallbuf library interposes some critical
        // external symbols like XShmQueryExtension(), so we
        // preload it whether or not syscallbuf is enabled. Indicate here whether
        // syscallbuf is enabled.
        if options.use_syscall_buffer == SyscallBuffering::DisableSyscallBuf {
            env::remove_var(SYSCALLBUF_ENABLED_ENV_VAR);
        } else {
            env::set_var(SYSCALLBUF_ENABLED_ENV_VAR, "1");
            check_perf_event_paranoid();
        }
        let mut env: Vec<(OsString, OsString)> = env::vars_os().collect();
        env.extend_from_slice(&options.extra_env);
        let full_path = lookup_by_path(&options.args[0]);
        let exe_info: ExeInfo = read_exe_info(&full_path);
        // LD_PRELOAD the syscall interception lib
        let maybe_syscall_buffer_lib_path = find_helper_library(SYSCALLBUF_LIB_FILENAME);
        match maybe_syscall_buffer_lib_path {
            Some(syscall_buffer_lib_path) => {
                let mut ld_preload = Vec::<u8>::new();
                match &exe_info.libasan_path {
                    Some(asan_path) => {
                        log!(LogDebug, "Prepending {:?} to LD_PRELOAD", asan_path);
                        // Put an LD_PRELOAD entry for it before our preload library, because
                        // it checks that it's loaded first
                        ld_preload.extend_from_slice(asan_path.as_bytes());
                        ld_preload.push(b':');
                    }
                    None => (),
                }
                ld_preload.extend_from_slice(syscall_buffer_lib_path.as_bytes());
                ld_preload.extend_from_slice(SYSCALLBUF_LIB_FILENAME_PADDED.as_bytes());
                inject_ld_helper_library(&mut env, &OsStr::new("LD_PRELOAD"), ld_preload);
            }
            None => (),
        }
        env.push(("RUNNING_UNDER_RD".into(), "1".into()));
        // Stop Mesa using the GPU
        env.push(("LIBGL_ALWAYS_SOFTWARE".into(), "1".into()));
        // Stop sssd from using shared-memory with its daemon
        env.push(("SSS_NSS_USE_MEMCACHE".into(), "NO".into()));
        // Disable Gecko's "wait for gdb to attach on process crash" behavior, since
        // it is useless when running under rr.
        env.push(("MOZ_GDB_SLEEP".into(), "0".into()));
        // If we have CPUID faulting, don't use these environment hacks. We don't
        // need them and the user might want to use them themselves for other reasons.
        if !SessionInner::has_cpuid_faulting() {
            // OpenSSL uses RDRAND, but we can disable it. These bitmasks are inverted
            // and ANDed with the results of CPUID. The number below is 2^62, which is the
            // bit for RDRAND support.
            env.push(("OPENSSL_ia32cap".into(), "~4611686018427387904:~0".into()));
            // Disable Qt's use of RDRAND/RDSEED/RTM
            env.push(("QT_NO_CPU_FEATURE".into(), "rdrand rdseed rtm".into()));
        }
        RecordSession::new(
            &full_path,
            &env,
            options,
            exe_info.has_asan_symbols || exe_info.libasan_path.is_some(),
        )
    }
pub fn create ( options : & RecordCommand ) -> SessionSharedPtr { // The syscallbuf library interposes some critical // external symbols like XShmQueryExtension(), so we // preload it whether or not syscallbuf is enabled. Indicate here whether // syscallbuf is enabled. if options . use_syscall_buffer == SyscallBuffering :: DisableSyscallBuf { env :: remove_var ( SYSCALLBUF_ENABLED_ENV_VAR ) ; } else { env :: set_var ( SYSCALLBUF_ENABLED_ENV_VAR , " " ) ; check_perf_event_paranoid ( ) ; } let mut env : Vec < ( OsString , OsString ) > = env :: vars_os ( ) . collect ( ) ; env . extend_from_slice ( & options . extra_env ) ; let full_path = lookup_by_path ( & options . args [ 0 ] ) ; let exe_info : ExeInfo = read_exe_info ( & full_path ) ; // LD_PRELOAD the syscall interception lib let maybe_syscall_buffer_lib_path = find_helper_library ( SYSCALLBUF_LIB_FILENAME ) ; match maybe_syscall_buffer_lib_path { Some ( syscall_buffer_lib_path ) => { let mut ld_preload = Vec :: < u8 > :: new ( ) ; match & exe_info . libasan_path { Some ( asan_path ) => { log ! ( LogDebug " " asan_path ) ; // Put an LD_PRELOAD entry for it before our preload library, because // it checks that it's loaded first ld_preload . extend_from_slice ( asan_path . as_bytes ( ) ) ; ld_preload . push ( b':' ) ; } None => ( ) , } ld_preload . extend_from_slice ( syscall_buffer_lib_path . as_bytes ( ) ) ; ld_preload . extend_from_slice ( SYSCALLBUF_LIB_FILENAME_PADDED . as_bytes ( ) ) ; inject_ld_helper_library ( & mut env , & OsStr :: new ( " " ) , ld_preload ) ; } None => ( ) , } env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; // Stop Mesa using the GPU env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; // Stop sssd from using shared-memory with its daemon env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; // Disable Gecko's "wait for gdb to attach on process crash" behavior, since // it is useless when running under rr. env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; // If we have CPUID faulting, don't use these environment hacks. We don't // need them and the user might want to use them themselves for other reasons. if ! SessionInner :: has_cpuid_faulting ( ) { // OpenSSL uses RDRAND, but we can disable it. These bitmasks are inverted // and ANDed with the results of CPUID. The number below is 2^62, which is the // bit for RDRAND support. env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; // Disable Qt's use of RDRAND/RDSEED/RTM env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; } RecordSession :: new ( & full_path , & env , options , exe_info . has_asan_symbols || exe_info . libasan_path . is_some ( ) , ) }
Create a recording session for the initial command line argv.
Create a recording session for the initial command line argv .
options
&RecordCommand