当前位置: 首页 > news >正文

初识rust


调试下rust 的执行流程

参考:

认识 Cargo - Rust语言圣经(Rust Course)

新建一个hello world 程序:

fn main() {println!("Hello, world!");
}

用IDA 打开exe,并加载符号:

根据字符串找到主程序入口:

双击该符号,然后按x,快捷键,查看所有的符号引用:

之后跳转到对应的程序位置:

PE 起始地址为140000000

读取"hello,world"字符的指令地址:140001040:

使用windbg ,加载该程序,并在lea 指令的位置下断点:

0:000> kp# Child-SP          RetAddr               Call Site
00 000000e6`c38ff9a8 00007ff7`b2571006     hello_world!__ImageBase
01 000000e6`c38ff9b0 00007ff7`b257101c     hello_world!__ImageBase
02 000000e6`c38ff9e0 00007ff7`b25736a8     hello_world!__ImageBase
03 (Inline Function) --------`--------     hello_world!std::rt::lang_start_internal::closure$2(void)+0xb [/rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\rt.rs @ 148] 
04 (Inline Function) --------`--------     hello_world!std::panicking::try::do_call(void)+0xb [/rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs @ 502] 
05 (Inline Function) --------`--------     hello_world!std::panicking::try(void)+0xb [/rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs @ 466] 
06 (Inline Function) --------`--------     hello_world!std::panic::catch_unwind(void)+0xb [/rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panic.rs @ 142] 
07 000000e6`c38ffa10 00007ff7`b25710ac     hello_world!std::rt::lang_start_internal(void)+0xb8 [/rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\rt.rs @ 148] 
08 000000e6`c38ffb10 00007ff7`b258a510     hello_world!main+0x2c
09 (Inline Function) --------`--------     hello_world!invoke_main(void)+0x22 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 78] 
0a 000000e6`c38ffb50 00007ffc`c2a0257d     hello_world!__scrt_common_main_seh(void)+0x10c [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
0b 000000e6`c38ffb90 00007ffc`c39caa78     KERNEL32!BaseThreadInitThunk+0x1d
0c 000000e6`c38ffbc0 00000000`00000000     ntdll!RtlUserThreadStart+0x28
//! Runtime services
//!
//! The `rt` module provides a narrow set of runtime services,
//! including the global heap (exported in `heap`) and unwinding and
//! backtrace support. The APIs in this module are highly unstable,
//! and should be considered as private implementation details for the
//! time being.#![unstable(feature = "rt",reason = "this public module should not exist and is highly likely \to disappear",issue = "none"
)]
#![doc(hidden)]
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(unused_macros)]use crate::ffi::CString;// Re-export some of our utilities which are expected by other crates.
pub use crate::panicking::{begin_panic, panic_count};
pub use core::panicking::{panic_display, panic_fmt};use crate::sync::Once;
use crate::sys;
use crate::sys_common::thread_info;
use crate::thread::Thread;// Prints to the "panic output", depending on the platform this may be:
// - the standard error output
// - some dedicated platform specific output
// - nothing (so this macro is a no-op)
macro_rules! rtprintpanic {($($t:tt)*) => {if let Some(mut out) = crate::sys::stdio::panic_output() {let _ = crate::io::Write::write_fmt(&mut out, format_args!($($t)*));}}
}macro_rules! rtabort {($($t:tt)*) => {{rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));crate::sys::abort_internal();}}
}macro_rules! rtassert {($e:expr) => {if !$e {rtabort!(concat!("assertion failed: ", stringify!($e)));}};
}macro_rules! rtunwrap {($ok:ident, $e:expr) => {match $e {$ok(v) => v,ref err => {let err = err.as_ref().map(drop); // map Ok/Some which might not be Debugrtabort!(concat!("unwrap failed: ", stringify!($e), " = {:?}"), err)}}};
}// One-time runtime initialization.
// Runs before `main`.
// SAFETY: must be called only once during runtime initialization.
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
//
// # The `sigpipe` parameter
//
// Since 2014, the Rust runtime on Unix has set the `SIGPIPE` handler to
// `SIG_IGN`. Applications have good reasons to want a different behavior
// though, so there is a `#[unix_sigpipe = "..."]` attribute on `fn main()` that
// can be used to select how `SIGPIPE` shall be setup (if changed at all) before
// `fn main()` is called. See <https://github.com/rust-lang/rust/issues/97889>
// for more info.
//
// The `sigpipe` parameter to this function gets its value via the code that
// rustc generates to invoke `fn lang_start()`. The reason we have `sigpipe` for
// all platforms and not only Unix, is because std is not allowed to have `cfg`
// directives as this high level. See the module docs in
// `src/tools/tidy/src/pal.rs` for more info. On all other platforms, `sigpipe`
// has a value, but its value is ignored.
//
// Even though it is an `u8`, it only ever has 4 values. These are documented in
// `compiler/rustc_session/src/config/sigpipe.rs`.
#[cfg_attr(test, allow(dead_code))]
unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {unsafe {sys::init(argc, argv, sigpipe);let main_guard = sys::thread::guard::init();// Next, set up the current Thread with the guard information we just// created. Note that this isn't necessary in general for new threads,// but we just do this to name the main thread and to give it correct// info about the stack bounds.let thread = Thread::new(Some(rtunwrap!(Ok, CString::new("main"))));thread_info::set(main_guard, thread);}
}// One-time runtime cleanup.
// Runs after `main` or at program exit.
// NOTE: this is not guaranteed to run, for example when the program aborts.
pub(crate) fn cleanup() {static CLEANUP: Once = Once::new();CLEANUP.call_once(|| unsafe {// Flush stdout and disable buffering.crate::io::cleanup();// SAFETY: Only called once during runtime cleanup.sys::cleanup();});
}// To reduce the generated code of the new `lang_start`, this function is doing
// the real work.
#[cfg(not(test))]
fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindSafe),argc: isize,argv: *const *const u8,sigpipe: u8,
) -> Result<isize, !> {use crate::{mem, panic};let rt_abort = move |e| {mem::forget(e);rtabort!("initialization or cleanup bug");};// Guard against the code called by this function from unwinding outside of the Rust-controlled// code, which is UB. This is a requirement imposed by a combination of how the// `#[lang="start"]` attribute is implemented as well as by the implementation of the panicking// mechanism itself.//// There are a couple of instances where unwinding can begin. First is inside of the// `rt::init`, `rt::cleanup` and similar functions controlled by bstd. In those instances a// panic is a std implementation bug. A quite likely one too, as there isn't any way to// prevent std from accidentally introducing a panic to these functions. Another is from// user code from `main` or, more nefariously, as described in e.g. issue #86030.// SAFETY: Only called once during runtime initialization.panic::catch_unwind(move || unsafe { init(argc, argv, sigpipe) }).map_err(rt_abort)?;let ret_code = panic::catch_unwind(move || panic::catch_unwind(main).unwrap_or(101) as isize).map_err(move |e| {mem::forget(e);rtabort!("drop of the panic payload panicked");});panic::catch_unwind(cleanup).map_err(rt_abort)?;ret_code
}#[cfg(not(test))]
#[lang = "start"]
fn lang_start<T: crate::process::Termination + 'static>(main: fn() -> T,argc: isize,argv: *const *const u8,sigpipe: u8,
) -> isize {let Ok(v) = lang_start_internal(&move || crate::sys_common::backtrace::__rust_begin_short_backtrace(main).report().to_i32(),argc,argv,sigpipe,);v
}

其核心运行时如上

panic

看起来是利用panic 库进行一些基本的异常捕获与异常处理。

panic! 深入剖析 - Rust语言圣经(Rust Course)

实验:

主动 异常
fn main() {panic!("crash and burn");
}
PS E:\learn\rust\panic_test> $env:RUST_BACKTRACE="full" ; cargo run releaseCompiling panic_test v0.1.0 (E:\learn\rust\panic_test)Finished dev [unoptimized + debuginfo] target(s) in 0.18sRunning `target\debug\panic_test.exe release`
thread 'main' panicked at src\main.rs:2:5:
crash and burn
stack backtrace:0:     0x7ff7a439709a - std::sys_common::backtrace::_print::impl$0::fmtat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:441:     0x7ff7a43a52db - core::fmt::rt::Argument::fmtat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\fmt\rt.rs:1382:     0x7ff7a43a52db - core::fmt::writeat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\fmt\mod.rs:10943:     0x7ff7a43953d1 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\io\mod.rs:17144:     0x7ff7a4396e1a - std::sys_common::backtrace::_printat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:475:     0x7ff7a4396e1a - std::sys_common::backtrace::printat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:346:     0x7ff7a4398e4a - std::panicking::default_hook::closure$1at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:2707:     0x7ff7a4398ab8 - std::panicking::default_hookat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:2908:     0x7ff7a43994fe - std::panicking::rust_panic_with_hookat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:7079:     0x7ff7a43993aa - std::panicking::begin_panic_handler::closure$0at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:59710:     0x7ff7a4397a89 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:170    11:     0x7ff7a43990f0 - std::panicking::begin_panic_handlerat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:59512:     0x7ff7a43aa235 - core::panicking::panic_fmtat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\panicking.rs:6713:     0x7ff7a43910a1 - panic_test::mainat E:\learn\rust\panic_test\src\main.rs:214:     0x7ff7a439123b - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\core\src\ops\function.rs:25015:     0x7ff7a439119e - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\sys_common\backtrace.rs:154    16:     0x7ff7a439119e - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\sys_common\backtrace.rs:154    17:     0x7ff7a4391061 - std::rt::lang_start::closure$0<tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\rt.rs:16618:     0x7ff7a4393558 - std::rt::lang_start_internal::closure$2at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\rt.rs:14819:     0x7ff7a4393558 - std::panicking::try::do_callat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:50220:     0x7ff7a4393558 - std::panicking::tryat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:46621:     0x7ff7a4393558 - std::panic::catch_unwindat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panic.rs:14222:     0x7ff7a4393558 - std::rt::lang_start_internalat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\rt.rs:14823:     0x7ff7a439103a - std::rt::lang_start<tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\rt.rs:16524:     0x7ff7a43910c9 - main25:     0x7ff7a43a8c80 - invoke_mainat D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:7826:     0x7ff7a43a8c80 - __scrt_common_main_sehat D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:28827:     0x7ffcc2a0257d - BaseThreadInitThunk28:     0x7ffcc39caa78 - RtlUserThreadStart
error: process didn't exit successfully: `target\debug\panic_test.exe release` (exit code: 101)
被动 异常
fn main() {let v = vec![1, 2, 3];v[99];
}
PS E:\learn\rust\panic_test> $env:RUST_BACKTRACE="full" ; cargo run releaseFinished dev [unoptimized + debuginfo] target(s) in 0.00sRunning `target\debug\panic_test.exe release`
thread 'main' panicked at src\main.rs:4:6:
index out of bounds: the len is 3 but the index is 99
stack backtrace:0:     0x7ff75aca794a - std::sys_common::backtrace::_print::impl$0::fmtat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:441:     0x7ff75acb5c1b - core::fmt::rt::Argument::fmtat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\fmt\rt.rs:1382:     0x7ff75acb5c1b - core::fmt::writeat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\fmt\mod.rs:10943:     0x7ff75aca5c81 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\io\mod.rs:17144:     0x7ff75aca76ca - std::sys_common::backtrace::_printat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:475:     0x7ff75aca76ca - std::sys_common::backtrace::printat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:346:     0x7ff75aca978a - std::panicking::default_hook::closure$1at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:2707:     0x7ff75aca93f8 - std::panicking::default_hookat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:2908:     0x7ff75aca9e3e - std::panicking::rust_panic_with_hookat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:7079:     0x7ff75aca9d2d - std::panicking::begin_panic_handler::closure$0at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:59910:     0x7ff75aca8339 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\sys_common\backtrace.rs:170    11:     0x7ff75aca9a30 - std::panicking::begin_panic_handlerat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:59512:     0x7ff75acbab75 - core::panicking::panic_fmtat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\panicking.rs:6713:     0x7ff75acbacee - core::panicking::panic_bounds_checkat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\panicking.rs:16214:     0x7ff75aca1afd - core::slice::index::impl$2::index<i32>at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\core\src\slice\index.rs:26115:     0x7ff75aca1076 - alloc::vec::impl$12::index<i32,usize,alloc::alloc::Global>at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\alloc\src\vec\mod.rs:267516:     0x7ff75aca1366 - panic_test::mainat E:\learn\rust\panic_test\src\main.rs:417:     0x7ff75aca14ab - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\core\src\ops\function.rs:25018:     0x7ff75aca13de - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\sys_common\backtrace.rs:154    19:     0x7ff75aca13de - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\sys_common\backtrace.rs:154    20:     0x7ff75aca12e1 - std::rt::lang_start::closure$0<tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\rt.rs:16621:     0x7ff75aca3e08 - std::rt::lang_start_internal::closure$2at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\rt.rs:14822:     0x7ff75aca3e08 - std::panicking::try::do_callat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:50223:     0x7ff75aca3e08 - std::panicking::tryat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:46624:     0x7ff75aca3e08 - std::panic::catch_unwindat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panic.rs:14225:     0x7ff75aca3e08 - std::rt::lang_start_internalat /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\rt.rs:14826:     0x7ff75aca12ba - std::rt::lang_start<tuple$<> >at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\std\src\rt.rs:16527:     0x7ff75aca13c9 - main28:     0x7ff75acb95c0 - invoke_mainat D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:7829:     0x7ff75acb95c0 - __scrt_common_main_sehat D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:28830:     0x7ffcc2a0257d - BaseThreadInitThunk31:     0x7ffcc39caa78 - RtlUserThreadStart
error: process didn't exit successfully: `target\debug\panic_test.exe release` (exit code: 101)

可以看到,包括我们用windbg 看到的,比较完整的js 运行时的入口都看到了

 rust 程序main 入口前,就已经安装了一个默认的panic handler ,用来打印一些全局的错误信息,和堆栈列表。

rt.rs 详解

int __cdecl main(int argc, const char **argv, const char **envp)
{char v4; // [rsp+20h] [rbp-18h]__int64 (__fastcall *v5)(); // [rsp+30h] [rbp-8h] BYREFv5 = sub_140001040;v4 = 0;return std::rt::lang_start_internal::h8a2184178aa988dc(&v5, &off_14001D360, argc, argv, v4);
}

其中,sub_140001040 即为main 函数:

 

__int64 sub_140001040()
{__int64 v1[3]; // [rsp+28h] [rbp-30h] BYREF__int128 v2; // [rsp+40h] [rbp-18h]v1[0] = (__int64)&off_14001D3A0;v1[1] = 1i64;v1[2] = (__int64)"called `Option::unwrap()` on a `None` value";v2 = 0i64;return std::io::stdio::_print::h445fdab5382e0576(v1);
}

 

相关文章:

初识rust

调试下rust 的执行流程 参考&#xff1a; 认识 Cargo - Rust语言圣经(Rust Course) 新建一个hello world 程序&#xff1a; fn main() {println!("Hello, world!"); }用IDA 打开exe&#xff0c;并加载符号&#xff1a; 根据字符串找到主程序入口&#xff1a; 双击…...

shiro-cve2016-4437漏洞复现

一、漏洞特征 Apache Shiro是一款开源强大且易用的Java安全框架&#xff0c;提供身份验证、授权、密码学和会话管理。Shiro框架直观、易用&#xff0c;同时也能提供健壮的安全性。 因为在反序列化时,不会对其进行过滤,所以如果传入恶意代码将会造成安全问题 在 1.2.4 版本前, 加…...

【MongoDB-Redis-MySQL-Elasticsearch-Kibana-RabbitMQ-MinIO】Java全栈开发软件一网打尽

“Java全栈开发一网打尽&#xff1a;在Windows环境下探索技术世界的奇妙之旅” 前言 全栈开发是一项复杂而令人兴奋的任务&#xff0c;涵盖了从前端到后端、数据库到可视化层、消息队列到文件存储的广泛领域。本文将带您深入探讨在Windows环境下进行全栈开发的过程&#xff0…...

Implementing class错误解决

最近在使用IDEASmart Tomcat启动项目时&#xff0c;报以下错误&#xff1a; Injection of resource dependencies failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class根据网上结论加上我这里的原因&#xff0c;总共以下几个方面&#x…...

关于 国产系统UOS系统Qt开发Tcp服务器外部连接无法连接上USO系统 的解决方法

若该文为原创文章&#xff0c;转载请注明原文出处 本文章博客地址&#xff1a;https://hpzwl.blog.csdn.net/article/details/134254817 红胖子(红模仿)的博文大全&#xff1a;开发技术集合&#xff08;包含Qt实用技术、树莓派、三维、OpenCV、OpenGL、ffmpeg、OSG、单片机、软…...

初阶JavaEE(15)(Cookie 和 Session、理解会话机制 (Session)、实现用户登录网页、上传文件网页、常用的代码片段)

接上次博客&#xff1a;初阶JavaEE&#xff08;14&#xff09;表白墙程序-CSDN博客 Cookie 和 Session 你还记得我们之前提到的Cookie吗&#xff1f; Cookie是HTTP请求header中的一个属性&#xff0c;是一种用于在浏览器和服务器之间持久存储数据的机制&#xff0c;允许网站…...

C++入门学习(1)命名空间和输入输出

前言 在C语言和基本的数据结构学习之后&#xff0c;我们终于迎来了期待已久的C啦&#xff01;C发明出来的意义就是填补一些C语言的不足&#xff0c;让我们更加方便的写代码&#xff0c;所以今天我们就来讲一下C语言不足的地方和在C中的解决办法&#xff01; 一、命名空间 在学习…...

AI:58-基于深度学习的猫狗图像识别

🚀 本文选自专栏:AI领域专栏 从基础到实践,深入了解算法、案例和最新趋势。无论你是初学者还是经验丰富的数据科学家,通过案例和项目实践,掌握核心概念和实用技能。每篇案例都包含代码实例,详细讲解供大家学习。 📌📌📌在这个漫长的过程,中途遇到了不少问题,但是…...

【原创】java+swing+mysql宠物领养管理系统设计与实现

摘要&#xff1a; 生活中&#xff0c;有很多被人遗弃的宠物&#xff0c;这些宠物的处理成为了一个新的难题。生活中也有许多人喜欢养宠物&#xff0c;为了方便大家进行宠物领养&#xff0c;提高宠物领养管理的效率和便利性。本文针对这一问题&#xff0c;提出设计和实现一个基…...

虚拟机Linux-Centos系统网络配置常用命令+Docker 的常用命令

目录 1、虚拟机Linux-Centos系统网络配置常用命令2、Docker 的常用命令2.1 安装docker步骤命令2.2 在docker容器中安装和运行mysql 2、dockerfile关键字区别(ADD/COPY,CMD/ENTRYPOINT) 1、虚拟机Linux-Centos系统网络配置常用命令 进入网络配置文件目录 cd /etc/sysconfig/ne…...

数据分析相关知识整理_--秋招面试版

一、关于sql语句(常问&#xff09; 1&#xff09;sql写过的复杂的运算 聚合函数&#xff0c;case when then end语句进行条件运算&#xff0c;字符串的截取、替换&#xff0c;日期的运算&#xff0c;排名等等&#xff1b;行列转换&#xff1b; eg&#xff1a;行列转换 SELE…...

HMM与LTP词性标注之命名实体识别与HMM

文章目录 知识图谱介绍NLP应用场景知识图谱&#xff08;Neo4j演示&#xff09;命名实体识别模型架构讲解HMM与CRFHMM五大要素&#xff08;两大状态与三大概率&#xff09;HMM案例分享HMM实体识别应用场景代码实现 知识图谱介绍 NLP应用场景 图谱的本质&#xff0c;就是把自然…...

Sui发布RPC2.0 Beta,拥抱GraphQL并计划弃用JSON-RPC

为了解决现有RPC存在的许多已知问题&#xff0c;Sui正在准备推出一个基于GraphQL的新RPC服务&#xff0c;名为Sui RPC 2.0。GraphQL是一种开源数据查询和操作语言&#xff0c;旨在简化需要复杂数据查询的API和服务。 用户目前可以访问Sui主网和测试网网络的Beta版本的只读快照…...

设计模式—结构型模式之桥接模式

设计模式—结构型模式之桥接模式 将抽象与实现解耦&#xff0c;使两者都可以独立变化。 在现实生活中&#xff0c;某些类具有两个或多个维度的变化&#xff0c;如图形既可按形状分&#xff0c;又可按颜色分。如何设计类似于 Photoshop 这样的软件&#xff0c;能画不同形状和不…...

【RabbitMQ】RabbitMQ 消息的堆积问题 —— 使用惰性队列解决消息的堆积问题

文章目录 一、消息的堆积问题1.1 什么是消息的堆积问题1.2 消息堆积的解决思路 二、惰性队列解决消息堆积问题2.1 惰性队列和普通队列的区别2.2 惰性队列的声明方式2.3 演示惰性队列接收大量消息2.4 惰性队列的优缺点 一、消息的堆积问题 1.1 什么是消息的堆积问题 消息的堆积…...

深度优先遍历与连通分量

深度优先遍历(Depth First Search)的主要思想是首先以一个未被访问过的顶点作为起始顶点&#xff0c;沿当前顶点的边走到未访问过的顶点。当没有未访问过的顶点时&#xff0c;则回到上一个顶点&#xff0c;继续试探别的顶点&#xff0c;直至所有的顶点都被访问过。 下图示例的…...

Python学习笔记--类的继承

七、类的继承 1、定义类的继承 说到继承&#xff0c;你一定会联想到继承你老爸的家产之类的。 类的继承也是一样。 比如有一个旧类&#xff0c;是可以算平均数的。然后这时候有一个新类&#xff0c;也要用到算平均数&#xff0c;那么这时候我们就可以使用继承的方式。新类继…...

全自动批量AI改写文章发布软件【软件脚本+技术教程】

项目原理&#xff1a; 利用AI工具将爆款文章改写发布到平台上流量变现,通过播放量赚取收益 软件功能&#xff1a; 1.可以根据你选的文章领域&#xff0c;识别你在网站上抓取的文章链接进来自动洗稿生成过原创的文章&#xff0c;自动配图 2.同时还可以将管理的账号导入进脚本软…...

strongswan:configure: error: OpenSSL Crypto library not found

引子 在配置strongswan时&#xff0c;有时会遇到以下错误&#xff08;其实所有需要openssl的软件configure时都有可能遇到该问题&#xff09;&#xff1a; configure: error: OpenSSL Crypto library not found 解决方法 crypto是什么呢? 是OpenSSL 加密库(lib), 这个库需要op…...

Xcode 常见错误

1. Xcode 15 编译出现以下错误 clang: error: SDK does not contain libarclite at the path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a; try increasing the minimum deployment target 从…...

CTF show Web 红包题第六弹

提示 1.不是SQL注入 2.需要找关键源码 思路 进入页面发现是一个登录框&#xff0c;很难让人不联想到SQL注入&#xff0c;但提示都说了不是SQL注入&#xff0c;所以就不往这方面想了 ​ 先查看一下网页源码&#xff0c;发现一段JavaScript代码&#xff0c;有一个关键类ctfs…...

智能在线客服平台:数字化时代企业连接用户的 AI 中枢

随着互联网技术的飞速发展&#xff0c;消费者期望能够随时随地与企业进行交流。在线客服平台作为连接企业与客户的重要桥梁&#xff0c;不仅优化了客户体验&#xff0c;还提升了企业的服务效率和市场竞争力。本文将探讨在线客服平台的重要性、技术进展、实际应用&#xff0c;并…...

JUC笔记(上)-复习 涉及死锁 volatile synchronized CAS 原子操作

一、上下文切换 即使单核CPU也可以进行多线程执行代码&#xff0c;CPU会给每个线程分配CPU时间片来实现这个机制。时间片非常短&#xff0c;所以CPU会不断地切换线程执行&#xff0c;从而让我们感觉多个线程是同时执行的。时间片一般是十几毫秒(ms)。通过时间片分配算法执行。…...

优选算法第十二讲:队列 + 宽搜 优先级队列

优选算法第十二讲&#xff1a;队列 宽搜 && 优先级队列 1.N叉树的层序遍历2.二叉树的锯齿型层序遍历3.二叉树最大宽度4.在每个树行中找最大值5.优先级队列 -- 最后一块石头的重量6.数据流中的第K大元素7.前K个高频单词8.数据流的中位数 1.N叉树的层序遍历 2.二叉树的锯…...

LangChain知识库管理后端接口:数据库操作详解—— 构建本地知识库系统的基础《二》

这段 Python 代码是一个完整的 知识库数据库操作模块&#xff0c;用于对本地知识库系统中的知识库进行增删改查&#xff08;CRUD&#xff09;操作。它基于 SQLAlchemy ORM 框架 和一个自定义的装饰器 with_session 实现数据库会话管理。 &#x1f4d8; 一、整体功能概述 该模块…...

AI+无人机如何守护濒危物种?YOLOv8实现95%精准识别

【导读】 野生动物监测在理解和保护生态系统中发挥着至关重要的作用。然而&#xff0c;传统的野生动物观察方法往往耗时耗力、成本高昂且范围有限。无人机的出现为野生动物监测提供了有前景的替代方案&#xff0c;能够实现大范围覆盖并远程采集数据。尽管具备这些优势&#xf…...

第7篇:中间件全链路监控与 SQL 性能分析实践

7.1 章节导读 在构建数据库中间件的过程中&#xff0c;可观测性 和 性能分析 是保障系统稳定性与可维护性的核心能力。 特别是在复杂分布式场景中&#xff0c;必须做到&#xff1a; &#x1f50d; 追踪每一条 SQL 的生命周期&#xff08;从入口到数据库执行&#xff09;&#…...

日常一水C

多态 言简意赅&#xff1a;就是一个对象面对同一事件时做出的不同反应 而之前的继承中说过&#xff0c;当子类和父类的函数名相同时&#xff0c;会隐藏父类的同名函数转而调用子类的同名函数&#xff0c;如果要调用父类的同名函数&#xff0c;那么就需要对父类进行引用&#…...

redis和redission的区别

Redis 和 Redisson 是两个密切相关但又本质不同的技术&#xff0c;它们扮演着完全不同的角色&#xff1a; Redis: 内存数据库/数据结构存储 本质&#xff1a; 它是一个开源的、高性能的、基于内存的 键值存储数据库。它也可以将数据持久化到磁盘。 核心功能&#xff1a; 提供丰…...

在Spring Boot中集成RabbitMQ的完整指南

前言 在现代微服务架构中&#xff0c;消息队列&#xff08;Message Queue&#xff09;是实现异步通信、解耦系统组件的重要工具。RabbitMQ 是一个流行的消息中间件&#xff0c;支持多种消息协议&#xff0c;具有高可靠性和可扩展性。 本博客将详细介绍如何在 Spring Boot 项目…...