From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15487 invoked by alias); 6 Nov 2014 07:02:48 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 15417 invoked by uid 48); 6 Nov 2014 07:02:47 -0000 From: "xdje42 at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug symtab/17559] New: confusion on what the result of find_pc_symtab is Date: Thu, 06 Nov 2014 07:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xdje42 at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q4/txt/msg00203.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17559 Bug ID: 17559 Summary: confusion on what the result of find_pc_symtab is Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: xdje42 at gmail dot com Reading through all callers of find_pc_symtab I found this in gdb_disassembly: /* Assume symtab is valid for whole PC range. */ symtab = find_pc_symtab (low); if (symtab != NULL && symtab->linetable != NULL) { /* Convert the linetable to a bunch of my_line_entry's. */ le = symtab->linetable->item; nlines = symtab->linetable->nitems; } What if foo.c includes foo.h, and the function we're disassembling is in foo.h? The bug is observed with "disas /m function_in_header", it prints nothing, whereas "disas function_in_header" will properly print the disassembly. The problem here is that the result of find_pc_symtab is the primary symtab (AFAICT, and I haven't found anything to the contrary) but this function assumes the symtab for "low" is returned, even if it's a non-primary symtab. I have a significant change to symtab organization in progress, and one open question is how to handle this use-case. We want a lookup function that returns the symtab (primary or non-primary) for a given pc. That can either be achieved via one lookup function that returns (for the sake of discussion) the primary symtab (blockvector really) and then another lookup function that takes the result of that and finds the "real" symtab (in the above example we want the symtab for foo.h), or it can be achieved via having one lookup function that directly returns the desired symtab. The problem with the latter approach is that pc-based lookups don't use the line-number part of symtabs, so we kinda have to find the blockvector first anyway. -- You are receiving this mail because: You are on the CC list for the bug.