[ECOS] Re: Trying to Debug Ecos using GDB

Nick Garnett nickg@ecoscentric.com
Thu Apr 13 09:37:00 GMT 2006

"Fahd Abidi" <fabidi@ultsol.com> writes:

> Yes the kernel is built with debug symbols. I checked the libtarget.a
> file with objdump -s and saw disassembly and source code. So its in
> there. Libtarget.a is 17mb, if I strip it of symbols using objcopy -g
> then it drops to 1.7mb.
> When I go to the steps of linking with my application the final hello
> executable leaves out the symbols from the kernel.
> I may not be following what Andrew is saying, as far as I can tell I
> have included the debug symbols from all Parts of the kernel that are
> used, the appropriate setting in the kernel to enable debug bits is set.
> The -g CFLAG bit is set in the top level of the ecos project, so all
> debug symbols should be added.
> The resulting hello executable only has source info for hello.c no other
> sources are in that executable. I checked the compiler output and saw
> the -g flag getting passed to the application as well.

How are you detecting that the symbols are not there? Full debug info
should be included in the executable by default.

If I run nm on a typical test executable I see all the kernel
symbols. For example:

$ arm-elf-nm -CSn tm_basic | grep Cyg_Thread
62007de4 00000564 T Cyg_Thread::Cyg_Thread(unsigned int, void (*)(unsigned int), unsigned int, char*, unsigned int, unsigned int)
62008348 00000564 T Cyg_Thread::Cyg_Thread(unsigned int, void (*)(unsigned int), unsigned int, char*, unsigned int, unsigned int)
620088ac 00000088 T Cyg_Thread::check_this(cyg_assert_class_zeal) const
62008934 00000180 T Cyg_Thread::reinitialize()
62008ab4 00000130 T Cyg_Thread::~Cyg_Thread()
62008be4 00000130 T Cyg_Thread::~Cyg_Thread()
62008d14 00000064 T Cyg_Thread::exit()
62008d78 00000034 T Cyg_HardwareThread::thread_entry(Cyg_Thread*)
62008dac 00000118 T Cyg_Thread::sleep()
62008ec4 00000108 T Cyg_Thread::wake()
62008fcc 00000128 T Cyg_Thread::suspend()
620090f4 00000120 T Cyg_Thread::resume()
62009214 0000011c T Cyg_Thread::force_resume()
62009330 0000014c T Cyg_Thread::kill()
6200947c 00000224 T Cyg_Thread::set_priority(int)
620096a0 0000011c T Cyg_Thread::delay(unsigned long long)
620097bc 00000020 T Cyg_Thread::deliver_exception(int, unsigned int)
620097dc 0000010c T Cyg_ThreadTimer::alarm(Cyg_Alarm*, unsigned int)
62009a98 00000010 t _GLOBAL__I.11100__ZN18Cyg_HardwareThread12thread_entryEP10Cyg_Thread
62009aa8 00000010 t _GLOBAL__D.11100__ZN18Cyg_HardwareThread12thread_entryEP10Cyg_Thread
6200a154 0000003c T Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread*)
6200a190 00000078 T Cyg_ThreadQueue_Implementation::remove(Cyg_Thread*)
6200a460 00000040 T Cyg_Scheduler_Implementation::set_need_reschedule(Cyg_Thread*)
6200a4a0 000002e4 T Cyg_Scheduler_Implementation::add_thread(Cyg_Thread*)
6200a784 000001e8 T Cyg_Scheduler_Implementation::rem_thread(Cyg_Thread*)
6200a96c 00000014 T Cyg_Scheduler_Implementation::set_idle_thread(Cyg_Thread*, unsigned int)
6200a980 00000004 T Cyg_Scheduler_Implementation::register_thread(Cyg_Thread*)
6200a984 00000004 T Cyg_Scheduler_Implementation::deregister_thread(Cyg_Thread*)
6200ad38 00000054 T Cyg_ThreadQueue_Implementation::dequeue()
6200b488 000000e8 T Cyg_Scheduler::thread_entry(Cyg_Thread*)
6200b668 0000002c T Cyg_SchedThread::Cyg_SchedThread(Cyg_Thread*, unsigned int)
6200b694 00000090 T Cyg_SchedThread::set_inherited_priority(int, Cyg_Thread*)
6200b724 00000018 T Cyg_SchedThread::relay_inherited_priority(Cyg_Thread*, Cyg_ThreadQueue*)
6200b7d4 000000b0 T Cyg_SchedThread::inherit_priority(Cyg_Thread*)
6200b884 00000004 T Cyg_SchedThread::relay_priority(Cyg_Thread*, Cyg_ThreadQueue*)
620135ac 00000020 r Cyg_Thread::reinitialize()::__PRETTY_FUNCTION__
620135cc 00000020 r Cyg_Thread::sleep()::__PRETTY_FUNCTION__
620135ec 0000001b r Cyg_Thread::suspend()::__PRETTY_FUNCTION__
62013608 0000001a r Cyg_Thread::resume()::__PRETTY_FUNCTION__
62013624 00000020 r Cyg_Thread::force_resume()::__PRETTY_FUNCTION__
62013644 0000002c r Cyg_Thread::set_priority(int)::__PRETTY_FUNCTION__
62013b94 0000003b r Cyg_Scheduler_Implementation::add_thread(Cyg_Thread*)::__PRETTY_FUNCTION__
62013bd0 0000003b r Cyg_Scheduler_Implementation::rem_thread(Cyg_Thread*)::__PRETTY_FUNCTION__
62013f2c 00000048 r Cyg_SchedThread::set_inherited_priority(int, Cyg_Thread*)::__PRETTY_FUNCTION__
62013fa8 00000034 r Cyg_SchedThread::inherit_priority(Cyg_Thread*)::__PRETTY_FUNCTION__
62015024 00000004 D Cyg_Thread::thread_list
621a736c 00000008 B Cyg_Thread::exception_control

What happens if you try that on your hello executable?

Nick Garnett                                 eCos Kernel Architect
http://www.ecoscentric.com            The eCos and RedBoot experts

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list