This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Handle sparc skipping unimp instruction with dwarf2


> Date: Wed, 05 Apr 2006 12:17:39 -0700 (PDT)
> From: "David S. Miller" <davem@davemloft.net>
> 
> > Oh, and could you rename sparc32_dwarf2_struct_return_p() to
> > sparc32_struct_return_p() and make sparc32_frame_cache() use that function
> > too?  The check isn't really dwarf2-specific and duplication of code
> > is bad!
> 
> Easier said than done :-) The else block of that code can't be used in
> the dwarf2 case, because when we can't find the "sym" for the function
> it wants to have the sparc frame cache information, such as whether
> this is a frameless function or not.  It uses this to determine
> whether to look at O7 or I7 as the return address register.

Ah yes, I spotted the duplicated logic, but didn't look much further.

> I tried to consolidate as much as I could.  In the dwarf2 case,
> if we have dwarf2 unwind information, and we can't find a symbol
> for the same function, we've got other problems right? :-)  The
> only other option I can think of is to pass in the retaddr_column
> to the ->init_reg() method but that seems unnecessary.

The consolidation is better I think, since now all the logic that
determines the struct_return stuff from the type is in one place.

We're not completely safe if we rely on always having the type info if
we have unwind info, since gdb also pays attention to .eh_frame
sections.  But let's worry about that if we see any problems.

> Anyways, how does this look?  Ok to commit?

ok

> 2006-04-05  David S. Miller  <davem@sunset.davemloft.net>
> 
> 	* dwarf2-frame.c (dwarf2_frame_ops init_reg): Add "next_frame"
> 	argument.
> 	(dwarf2_frame_default_init_reg): Likewise.
> 	(dwarf2_frame_set_init_reg): Update init_reg arg.
> 	(dwarf2_frame_init_reg): Take "next_frame" and pass it to
> 	ops->init_reg().
> 	(dwarf2_frame_cache): Pass next_frame to dwarf2_frame_init_reg.
> 	* dwarf2-frame.h (dwarf2-frame_set_init_reg): Update declaration.
> 	* cris-tdep.c (cris_dwarf2_frame_init_reg): Add next_frame arg.
> 	* s390-tdep.c (s390_dwarf2_frame_init_reg): Likewise.
> 	* sh-tdep.c (sh_dwarf2_frame_init_reg): Likewise.
> 	* sparc64-tdep.c (sparc64_dwarf2_frame_init_reg): Likewise.
> 	* sparc-tdep.c (sparc32_struct_return_from_sym): New function.
> 	(sparc32_frame_cache): Call it.
> 	(sparc32_dwarf2_struct_return_p): New function.
> 	(sparc_dwarf2_frame_init_reg): Use it to determine if the function
> 	returns a structure and thus we have to indicate the return PC and
> 	NPC are 4 bytes later than usual.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]