哪位同学了解C语言段错误调试,指导一下

这两天折腾 liberime 的时候,遇到下面的段错误,毫无头绪,不知道该怎么找问题,我的C语言也是现学现卖,有熟悉C语言调试的同学,指点一下。

[email protected]:~/projects/emacs/src$ ./emacs
Fatal error 11: Segmentation fault
Backtrace:
./emacs(+0x118dec)[0x567dec]
./emacs(+0x22b56)[0x471b56]
./emacs(+0x23028)[0x472028]
./emacs(+0x117518)[0x566518]
./emacs(+0x1175a1)[0x5665a1]
linux-gate.so.1(__kernel_rt_sigreturn+0x0)[0xb7f20d58]
./emacs(+0x1a38f2)[0x5f28f2]
/home/feng/projects/emacs-packages/liberime/build/liberime.so(notification_handler+0xb8)[0xb0936978]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime7Service6NotifyEjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_+0xa5)[0xaf398d35]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN5boost6detail8function26void_function_obj_invoker2ISt5_BindIFMN4rime7ServiceEFvjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESD_EPS5_jSt12_PlaceholderILi1EESH_ILi2EEEEvSD_SD_E6invokeERNS1_15function_bufferESD_SD_+0x2e)[0xaf39c99e]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN5boost8signals26detail11signal_implIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionISB_EENSG_IFvRKNS0_10connectionESA_SA_EEENS0_5mutexEEclESA_SA_+0x3cf)[0xaf38034f]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime14ConcreteEngine14OnOptionUpdateEPNS_7ContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x13e)[0xaf384b2e]
/usr/lib/i386-linux-gnu/librime.so.1(+0xe7c12)[0xaf384c12]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN5boost8signals26detail11signal_implIFvPN4rime7ContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionISE_EENSJ_IFvRKNS0_10connectionES5_SD_EEENS0_5mutexEEclES5_SD_+0x359)[0xaf378309]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime7Context10set_optionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb+0x101)[0xaf36eb31]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime6EditorC1ERKNS_6TicketEb+0x108)[0xaf44c438]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime13ExpressEditorC2ERKNS_6TicketE+0x23)[0xaf44ca83]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime9ComponentINS_13ExpressEditorEE6CreateERKNS_6TicketE+0x2a)[0xaf450ada]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime14ConcreteEngine20InitializeComponentsEv+0x4a8)[0xaf382ac8]
/usr/lib/i386-linux-gnu/librime.so.1(_ZN4rime14ConcreteEngine11ApplySchemaEPNS_6SchemaE+0xd6)[0xaf384f56]
/usr/lib/i386-linux-gnu/librime.so.1(RimeSelectSchema+0x86)[0xaf35ea66]
/home/feng/projects/emacs-packages/liberime/build/liberime.so(+0x1cf2)[0xb0936cf2]
./emacs(+0x1a63f8)[0x5f53f8]
./emacs(+0x17d250)[0x5cc250]
./emacs(+0x17c752)[0x5cb752]
./emacs(+0x17ca8f)[0x5cba8f]
./emacs(+0x17e7cf)[0x5cd7cf]
./emacs(+0x17aa8c)[0x5c9a8c]
./emacs(+0x1b439c)[0x60339c]
./emacs(+0x17d15a)[0x5cc15a]
./emacs(+0x17aa14)[0x5c9a14]
./emacs(+0x1b439c)[0x60339c]
./emacs(+0x17d15a)[0x5cc15a]
./emacs(+0x17aa14)[0x5c9a14]
./emacs(+0x17adf6)[0x5c9df6]
./emacs(+0x17aa8c)[0x5c9a8c]
./emacs(+0x1b439c)[0x60339c]
./emacs(+0x17d15a)[0x5cc15a]
./emacs(+0x17aa14)[0x5c9a14]
./emacs(+0x1773fd)[0x5c63fd]
./emacs(+0x17aa8c)[0x5c9a8c]
...
段错误

編譯時加上調試信息選項(-g),然後掛 gdb 運行 emacs,可以直接定位到發生段錯誤的那一行。

1 个赞

多谢,不过调试结果也如同天数 :joy:

gdb ./emacs core
GNU gdb (Debian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./emacs...done.
[New LWP 1294]
[New LWP 1295]
[New LWP 1297]
[New LWP 1298]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Core was generated by `./emacs'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xb7fc6d41 in __kernel_vsyscall ()
[Current thread is 1 (Thread 0xb27ccc40 (LWP 1294))]
warning: File "/home/feng/projects/emacs/src/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
	add-auto-load-safe-path /home/feng/projects/emacs/src/.gdbinit
line to your configuration file "/home/feng/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/feng/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
(gdb) bt
#0  0xb7fc6d41 in __kernel_vsyscall ()
#1  0xb5abc9b2 in __libc_signal_restore_set (set=0x9b756c <sigsegv_stack+6732>) at ../sysdeps/unix/sysv/linux/internal-signals.h:84
#2  0xb5abc9b2 in raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:48
#3  0x004e2b84 in terminate_due_to_signal (sig=11, backtrace_limit=40) at emacs.c:406
#4  0x004e3028 in handle_fatal_signal (sig=11) at sysdep.c:1793
#5  0x005d7518 in deliver_thread_signal ([email protected]=11, handler=0x4e300e <handle_fatal_signal>) at sysdep.c:1767
#6  0x005d75a1 in deliver_fatal_thread_signal (sig=11) at sysdep.c:1890
#7  0x005d75a1 in handle_sigsegv (sig=11, siginfo=0x9b778c <sigsegv_stack+7276>, arg=0x9b780c <sigsegv_stack+7404>) at sysdep.c:1890
#8  0xb7fc6d58 in <signal handler called> ()
#9  0x006638f2 in module_non_local_exit_get (env=0xbfc178bc, sym=0x2b86ed8, data=0x3) at emacs-module.c:444
#10 0xb08b3978 in notification_handler () at /home/feng/projects/emacs-packages/liberime/build/liberime.so
#11 0xac9a1d35 in rime::Service::Notify(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () at /usr/lib/i386-linux-gnu/librime.so.1
#12 0xac9a599e in boost::detail::function::void_function_obj_invoker2<std::_Bind<void (rime::Service::*(rime::Service*, unsigned int, std::_Placeholder<1>, std::_Placeholder<2>))(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>, void, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::invoke(boost::detail::function::function_buffer&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
    at /usr/lib/i386-linux-gnu/librime.so.1
#13 0xac98934f in boost::signals2::detail::signal_impl<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>, boost::function<void (boost::signals2::connection const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>, boost::signals2::mutex>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () at /usr/lib/i386-linux-gnu/librime.so.1
#14 0xac98db2e in rime::ConcreteEngine::OnOptionUpdate(rime::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () at /usr/lib/i386-linux-gnu/librime.so.1
#15 0xac98dc12 in  () at /usr/lib/i386-linux-gnu/librime.so.1
#16 0xac981309 in boost::signals2::detail::signal_impl<void (rime::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (rime::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>, boost::function<void (boost::signals2::connection const&, rime::Context*, std::__cxx11::basic_string<char, std::cha--Type <RET> for more, q to quit, c to continue without paging--
r_traits<char>, std::allocator<char> > const&)>, boost::signals2::mutex>::operator()(rime::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () at /usr/lib/i386-linux-gnu/librime.so.1
#17 0xac977b31 in rime::Context::set_option(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) ()
    at /usr/lib/i386-linux-gnu/librime.so.1
#18 0xaca55438 in rime::Editor::Editor(rime::Ticket const&, bool) () at /usr/lib/i386-linux-gnu/librime.so.1
#19 0xaca55a83 in rime::ExpressEditor::ExpressEditor(rime::Ticket const&) () at /usr/lib/i386-linux-gnu/librime.so.1
#20 0xaca59ada in rime::Component<rime::ExpressEditor>::Create(rime::Ticket const&) () at /usr/lib/i386-linux-gnu/librime.so.1
#21 0xac98bac8 in rime::ConcreteEngine::InitializeComponents() () at /usr/lib/i386-linux-gnu/librime.so.1
#22 0xac98df56 in rime::ConcreteEngine::ApplySchema(rime::Schema*) () at /usr/lib/i386-linux-gnu/librime.so.1
#23 0xac967a66 in RimeSelectSchema () at /usr/lib/i386-linux-gnu/librime.so.1
#24 0xb08b3cf2 in select_schema () at /home/feng/projects/emacs-packages/liberime/build/liberime.so
#25 0x006663f8 in funcall_module (function=0x2feeb45, nargs=1, arglist=0xbfc181e0) at emacs-module.c:902
#26 0x0063d250 in funcall_lambda (fun=0x2feeb45, nargs=1, arg_vector=0xbfc181e0) at eval.c:3003
#27 0x0063c752 in apply_lambda (fun=0x2feeb45, args=<optimized out>, [email protected]=72) at eval.c:2930
#28 0x0063ca8f in eval_sub (form=0x4d062ab) at eval.c:2314
#29 0x0063e7cf in Feval (form=0x4d062ab, lexical=0x0) at eval.c:2098
#30 0x0063aa8c in Ffuncall (nargs=3, args=0xbfc18344) at lisp.h:2081
#31 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0xb22c9a75, maxdepth=0x42, args_template=0x406, nargs=1, args=<optimized out>)
    at bytecode.c:633
#32 0x0063d15a in funcall_lambda (fun=0xb22c9a5d, nargs=1, arg_vector=0xbfc184fc) at lisp.h:1824
#33 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc184f8) at eval.c:2812
#34 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0xb22c9a2d, maxdepth=0x12, args_template=0x406, nargs=1, args=<optimized out>)
    at bytecode.c:633
#35 0x0063d15a in funcall_lambda (fun=0xb22c9a0d, nargs=1, arg_vector=0xbfc18730) at lisp.h:1824
#36 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc1872c) at eval.c:2812
#37 0x0063adf6 in Fapply (nargs=2, args=0xbfc1872c) at eval.c:2377
#38 0x0063aa8c in Ffuncall (nargs=3, args=0xbfc18728) at lisp.h:2081
#39 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0x35cd915, maxdepth=0x16, args_template=0x202, nargs=1, args=<optimized out>)
    at bytecode.c:633
#40 0x0063d15a in funcall_lambda (fun=0x35cd935, nargs=1, arg_vector=0xbfc18918) at lisp.h:1824
#41 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc18914) at eval.c:2812
#42 0x006373fd in Ffuncall_interactively (nargs=2, args=0xbfc18914) at callint.c:253
--Type <RET> for more, q to quit, c to continue without paging--
#43 0x0063aa8c in Ffuncall (nargs=3, args=0xbfc18910) at lisp.h:2081
#44 0x00637ca4 in Fcall_interactively (function=<optimized out>, record_flag=<optimized out>, keys=<optimized out>) at callint.c:781
#45 0x0063aa8c in Ffuncall (nargs=4, args=0xbfc18a6c) at lisp.h:2081
#46 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0xb22126ad, maxdepth=0x36, args_template=0x1006, nargs=1, args=<optimized out>)
    at bytecode.c:633
#47 0x0063d15a in funcall_lambda (fun=0xb2212695, nargs=1, arg_vector=0xbfc18c9c) at lisp.h:1824
#48 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc18c98) at eval.c:2812
#49 0x0063ab4f in call1 (fn=0x1ff8, arg1=0xb19014f0) at eval.c:2651
#50 0x005cdc48 in command_loop_1 () at lisp.h:1043
#51 0x00639c3b in internal_condition_case (bfun=0x5cd850 <command_loop_1>, handlers=0x2a48, hfun=0x5c45e0 <cmd_error>) at eval.c:1347
#52 0x005bf68f in command_loop_2 (ignore=0x0) at lisp.h:1043
#53 0x00639bb2 in internal_catch (tag=0x2b98, func=0x5bf660 <command_loop_2>, arg=0x0) at eval.c:1108
#54 0x005bf5af in command_loop () at lisp.h:1043
#55 0x005c4187 in recursive_edit_1 () at keyboard.c:714
#56 0x005c44e3 in Frecursive_edit () at keyboard.c:786
#57 0x0063aa8c in Ffuncall (nargs=1, args=0xbfc18f7c) at lisp.h:2081
#58 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0x4b7e8a5, maxdepth=0xa6, args_template=0x202, nargs=2, args=<optimized out>)
    at bytecode.c:633
#59 0x0063d15a in funcall_lambda (fun=0x4b2f345, nargs=2, arg_vector=0xbfc19304) at lisp.h:1824
#60 0x0063aa14 in Ffuncall (nargs=3, args=0xbfc19300) at eval.c:2812
#61 0x0063ad16 in Fapply (nargs=2, args=0xbfc19378) at eval.c:2420
#62 0x0063ae76 in apply1 (fn=<optimized out>, arg=0x469efd3) at lisp.h:1371
#63 0x0063b13c in call_debugger (arg=0x469efd3) at eval.c:340
#64 0x0063b8e6 in maybe_call_debugger (data=0x469f0db, sig=0x6dc8, conditions=0xb22792ab) at lisp.h:1043
#65 0x0063b8e6 in signal_or_quit (error_symbol=0x6dc8, data=0x469f0db, keyboard_quit=<optimized out>) at eval.c:1658
#66 0x004e53b7 in Fsignal (error_symbol=<optimized out>, data=0x469f0db) at eval.c:1560
#67 0x004e53f6 in xsignal (data=<optimized out>, error_symbol=0x6dc8) at lisp.h:4082
#68 0x004e53f6 in xsignal1 (error_symbol=0x6dc8, arg=0x400c850) at eval.c:1699
#69 0x0063ca22 in eval_sub (form=0x469f1f3) at lisp.h:1043
#70 0x0063e7cf in Feval (form=0x469f1f3, lexical=0x0) at eval.c:2098
#71 0x0063aa8c in Ffuncall (nargs=3, args=0xbfc195b4) at lisp.h:2081
#72 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0xb22c9a75, maxdepth=0x42, args_template=0x406, nargs=1, args=<optimized out>)
--Type <RET> for more, q to quit, c to continue without paging--
    at bytecode.c:633
#73 0x0063d15a in funcall_lambda (fun=0xb22c9a5d, nargs=1, arg_vector=0xbfc1976c) at lisp.h:1824
#74 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc19768) at eval.c:2812
#75 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0xb22c9a2d, maxdepth=0x12, args_template=0x406, nargs=1, args=<optimized out>)
    at bytecode.c:633
#76 0x0063d15a in funcall_lambda (fun=0xb22c9a0d, nargs=1, arg_vector=0xbfc199a0) at lisp.h:1824
#77 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc1999c) at eval.c:2812
#78 0x0063adf6 in Fapply (nargs=2, args=0xbfc1999c) at eval.c:2377
#79 0x0063aa8c in Ffuncall (nargs=3, args=0xbfc19998) at lisp.h:2081
#80 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0x35cd915, maxdepth=0x16, args_template=0x202, nargs=1, args=<optimized out>)
    at bytecode.c:633
#81 0x0063d15a in funcall_lambda (fun=0x35cd935, nargs=1, arg_vector=0xbfc19b88) at lisp.h:1824
#82 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc19b84) at eval.c:2812
#83 0x006373fd in Ffuncall_interactively (nargs=2, args=0xbfc19b84) at callint.c:253
#84 0x0063aa8c in Ffuncall (nargs=3, args=0xbfc19b80) at lisp.h:2081
#85 0x00637ca4 in Fcall_interactively (function=<optimized out>, record_flag=<optimized out>, keys=<optimized out>) at callint.c:781
#86 0x0063aa8c in Ffuncall (nargs=4, args=0xbfc19cdc) at lisp.h:2081
#87 0x0067439c in exec_byte_code (bytestr=<optimized out>, vector=0xb22126ad, maxdepth=0x36, args_template=0x1006, nargs=1, args=<optimized out>)
    at bytecode.c:633
#88 0x0063d15a in funcall_lambda (fun=0xb2212695, nargs=1, arg_vector=0xbfc19f0c) at lisp.h:1824
#89 0x0063aa14 in Ffuncall (nargs=2, args=0xbfc19f08) at eval.c:2812
#90 0x0063ab4f in call1 (fn=0x1ff8, arg1=0xb19014f0) at eval.c:2651
#91 0x005cdc48 in command_loop_1 () at lisp.h:1043
#92 0x00639c3b in internal_condition_case (bfun=0x5cd850 <command_loop_1>, handlers=0x2a48, hfun=0x5c45e0 <cmd_error>) at eval.c:1347
#93 0x005bf68f in command_loop_2 (ignore=0x0) at lisp.h:1043
#94 0x00639bb2 in internal_catch (tag=0x65d0, func=0x5bf660 <command_loop_2>, arg=0x0) at eval.c:1108
#95 0x005bf616 in command_loop () at lisp.h:1043
#96 0x005c4187 in recursive_edit_1 () at keyboard.c:714
#97 0x005c44e3 in Frecursive_edit () at keyboard.c:786
#98 0x004e90e0 in main (argc=<optimized out>, argv=<optimized out>) at emacs.c:1962
(gdb) 
(gdb)

librime 应该是C++写的吧

/home/feng/projects/emacs-packages/liberime/build/liberime.so(notification_handler+0xb8)[0xb0936978]
(_ZN4rime7Service6NotifyEjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_+0xa5)[0xaf398d35]
(_ZN5boost6detail8function26void_function_obj_invoker2ISt5_BindIFMN4rime7ServiceEFvjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESD_EPS5_jSt12_PlaceholderILi1EESH_ILi2EEEEvSD_SD_E6invokeERNS1_15function_bufferESD_SD_+0x2e)[0xaf39c99e]
(_ZN5boost8signals26detail11signal_implIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_ENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionISB_EENSG_IFvRKNS0_10connectionESA_SA_EEENS0_5mutexEEclESA_SA_+0x3cf)[0xaf38034f]
(_ZN4rime14ConcreteEngine14OnOptionUpdateEPNS_7ContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x13e)[0xaf384b2e]
(+0xe7c12)[0xaf384c12]
(_ZN5boost8signals26detail11signal_implIFvPN4rime7ContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionISE_EENSJ_IFvRKNS0_10connectionES5_SD_EEENS0_5mutexEEclES5_SD_+0x359)[0xaf378309]
(_ZN4rime7Context10set_optionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb+0x101)[0xaf36eb31]
(_ZN4rime6EditorC1ERKNS_6TicketEb+0x108)[0xaf44c438]
(_ZN4rime13ExpressEditorC2ERKNS_6TicketE+0x23)[0xaf44ca83]
(_ZN4rime9ComponentINS_13ExpressEditorEE6CreateERKNS_6TicketE+0x2a)[0xaf450ada]
(_ZN4rime14ConcreteEngine20InitializeComponentsEv+0x4a8)[0xaf382ac8]
(_ZN4rime14ConcreteEngine11ApplySchemaEPNS_6SchemaE+0xd6)[0xaf384f56]
(RimeSelectSchema+0x86)[0xaf35ea66]

函数的入口应该就是 RimeSelectSchema

他里面有一个 session->ApplySchema(new Schema(schema_id));

应该能对的上 _ZN4rime14ConcreteEngine11ApplySchemaEPNS_6SchemaE+0xd6

接下来 一步一步的找呗

有什么工具或者命令么?

rg 应该可以吧

git 应该也行

反正就是找关键代码点

调试我不会 都是直接输出或写日志

谢啦,不过以我当前c语言的水平,这个事情确实有点难度,先放放吧。

看起来是指针把内存搞挂了。如果有范围review下相关代码吧

他是C++ 不是C啊

有可重现的方法吗?

感觉 data=0x3不太对,看一下notification_handler中在调用module_non_local_exit_get前是不是对结构体指针解引用了,那个指针可能是空。

2 个赞

有可能,我用print大法调试一下

你是怎么调用的会挂掉?

emacs 加载 liberime 动态模块后,运行一个函数就会让emacs挂掉,进过摸索,是一个 funcall message 导致的,但到目前为止,还不知道是什么原因。

我个人的 liberime 镜像: https://github.com/tumashu/liberime