Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 149126

Summary: Gdb can't debug variables in inlined function
Product: Red Hat Enterprise Linux 4 Reporter: H.J. Lu <hongjiu.lu>
Component: gdbAssignee: Alexandre Oliva <aoliva>
Status: CLOSED DUPLICATE QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: cagney, jan.kratochvil, jjohnstn, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-01-02 02:04:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description H.J. Lu 2005-02-18 23:24:05 UTC
When I tried to debug linker from the default binutils build, I
got

Breakpoint 3, _bfd_elf_compute_section_file_positions (abfd=0x80fb618,
    link_info=0x80f1c20)
    at /export/gnu/src/binutils-shr/binutils/bfd/elf.c:3428
3428      for (s = abfd->sections; s != NULL; s = s->next)
(gdb) p sections
No symbol "sections" in current context.
(gdb) p count
No symbol "count" in current context.
(gdb)

Line 3428 is at inlined map_sections_to_segments:
static bfd_boolean
map_sections_to_segments (bfd *abfd)
{
  asection **sections = NULL;
  asection *s;
  unsigned int i;
  unsigned int count;
  struct elf_segment_map *mfirst;
  struct elf_segment_map **pm;
  struct elf_segment_map *m;
  asection *last_hdr;
  bfd_vma last_size;
  unsigned int phdr_index;
  bfd_vma maxpagesize;
  asection **hdrpp;
  bfd_boolean phdr_in_segment = TRUE;
  bfd_boolean writable;
  int tls_count = 0;
  int sharable_count = 0;
  asection *first_tls = NULL;
  asection *first_sharable = NULL;
  asection *dynsec, *eh_frame_hdr;
  bfd_size_type amt;

None of those local variables are visible to gdb although there are

 <1><a7e8>: Abbrev Number: 75 (DW_TAG_subprogram)
     DW_AT_sibling     : <a97e>
     DW_AT_name        : (indirect string, offset: 0x6801):
map_sections_to_segments
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3405
     DW_AT_prototyped  : 1
     DW_AT_type        : <942>
     DW_AT_inline      : 1      (inlined)
 <2><a7fa>: Abbrev Number: 76 (DW_TAG_formal_parameter)
     DW_AT_name        : (indirect string, offset: 0x235f): abfd
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3404
     DW_AT_type        : <b45>
 <2><a806>: Abbrev Number: 67 (DW_TAG_variable)
     DW_AT_name        : (indirect string, offset: 0x8f3e): sections
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3406
     DW_AT_type        : <6c60>
....

Comment 1 Jan Kratochvil 2007-01-02 02:04:56 UTC
As failed to retrieve the line-matching version of `bfd/elf.c' from CVS I see
this bug as DUPLICATED.  Proper Bug 149125 implementation should resolve it.


*** This bug has been marked as a duplicate of 149125 ***