This is the mail archive of the
mailing list for the binutils project.
Re: Problem caused by removed function and its remaining dwarf entry
- From: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- To: Terry Guo <flameroc at gmail dot com>
- Cc: Terry Guo <terry dot guo at arm dot com>, <binutils at sourceware dot org>, Yao Qi <Yao dot Qi at arm dot com>, Joey Ye <Joey dot Ye at arm dot com>
- Date: Thu, 26 Feb 2015 17:44:47 +0530
- Subject: Re: Problem caused by removed function and its remaining dwarf entry
- Authentication-results: sourceware.org; auth=none
- References: <000001d0476c$73b2eb90$5b18c2b0$ at arm dot com> <20150213093605 dot GA6972 at atmel dot com> <CAGbRaL7HvwKinWhxqK1R0Vw9d_t0abe=4jFN=p8pBW1BL1hNgA at mail dot gmail dot com>
On Fri, Feb 13, 2015 at 05:57:32PM +0800, Terry Guo wrote:
> On Fri, Feb 13, 2015 at 5:36 PM, Senthil Kumar Selvaraj
> <email@example.com> wrote:
> > On Fri, Feb 13, 2015 at 05:07:08PM +0800, Terry Guo wrote:
> >> Hi there,
> >> I have an unused function foo in file foo.c which is then compiled with -O0
> >> and -ffunction-sections. The foo function will be kept in foo.o and will get
> >> a dwarf entry in dwarf section. Lately the --gc-section will discard this
> >> unused function and its section, but won't clean its dwarf entry. Then when
> >> set breakpoint for function foo under gdb, gdb will use such remaining and
> >> incorrect dwarf entry to set breakpoint for no-longer-existing function foo.
> >> For embedded target, such incorrect information like PC value will be passed
> >> to hardware debug unit to set breakpoint, this will cause trouble.
> >> Is it possible to remove corresponding dwarf entry after --gc-section
> >> discarded sections? Please help. Thanks in advance.
> > I encountered this a while back (see
> > https://gcc.gnu.org/ml/gcc/2014-01/msg00116.html).
> > AFAIK, this requires changes in the way the compiler emits DWARF. Right
> > now, all debug info for a compilation unit are grouped together, and
> > unless the linker understands DWARF binary format, it can't removing the
> > entries.
> > So, we'd need to make the compiler emit the appropriate DW_TAGs, and
> > make gdb understand them.
> > Regards
> > Senthil
> Totally agree with your idea and patch. Do you have any plan to
> continue your work to get gcc accept your patch? I think it will be a
> very helpful feature.
Sure, I'll work on it and get something out next week.