struct DV_COMMON_EXPORT product_config { int detect_delay_ms = 0; int reject_delay_ms = 0; int detect_count_oneshot = 1; int detect_count = 0; int detect_count_interval = 100; std::string ref_image_path = "1"; int cam_x =2; int cam_y =3; // yuv420p",rgb888 std::string rpicam_pixel_type = "yuv420p"; int tmp =44;};
调试时发现从第一个字符串往后,字段都没有正常初始化
(gdb) info lineLine 1021 of "/repos/dv_app_solution/pri**_all/pri**/include/pri**/pri**Json.hpp" starts at address 0x7fffeb60f470 <pri**::json::fromJsonString<dv_common_config>(std::string const&&)+28> and ends at 0x7fffeb60f478 <pri**::json::fromJsonString<dv_common_config>(std::string const&&)+36>.(gdb) list10161017template <class T>1018static inline std::unique_ptr<T> fromJsonString(const std::string&& str)1019{1020 std::unique_ptr<T> model = std::make_unique<T>();1021 privates::jsonType<T>::type::from_jsonStr(std::move(*model), std::move(str), 0, static_cast<int>(str.length() - 1));10221023 return model;1024}1025template <class T>(gdb) print *model$9 = {detect_delay_ms = 0, reject_delay_ms = 0, detect_count_oneshot = 1, detect_count = 0, detect_count_interval = 100, ref_image_path = "", cam_x = 0, cam_y = 0, rpicam_pixel_type = <error reading variable: Cannot create a lazy string with address 0x0, and a non-zero length.>, tmp = 796092265}(gdb)
程序会在后面的逻辑中,崩溃在使用 rpicam_pixel_type 这个字段的时候,用 asan 看了是由于这个错误的字符串被认为超过 10 个 T 导致崩溃随便把它赋值给其他变量就会崩溃
没有思路,有什么方式进一进定位吗