Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jun Gong <heixia108@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH]Add symbol whose field 'has_type' has been set to partial symbol table
Date: Fri, 24 Jan 2014 06:19:00 -0000	[thread overview]
Message-ID: <CAB_AMN4J5Wo+gKsKoJaDPtA_5X7u5ibzPA2cXWQdLF0=Fuw1aQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1645 bytes --]

This patch intends to add symbol whose field 'has_type' has been set
to partial symbol table.

The patch and corresponding test case have been discussed and reviewed
before at https://sourceware.org/ml/gdb-patches/2013-10/msg00747.html
and https://sourceware.org/ml/gdb-patches/2013-11/msg00003.html.
However it has not been committed because Tom Tromey is very busy and
could not help commit it now. I have received copyright assignment.
Could you help review and commit the patch? Thank you!

The following are the summary of the patch, and the attachment
const-var.exp is test case.

1. Change for gdb/ChangeLog

2014-01-24  Jun Gong  <heixia108@gmail.com>

          * dwarf2read.c(add_partial_symbol): Add symbol whose field
'has_type' has been set to partial symbol table.

2. Diff for dwarf2read.c

diff -up gdb-7.7.50.20140124.orig/gdb/dwarf2read.c
gdb-7.7.50.20140124/gdb/dwarf2read.c
--- gdb-7.7.50.20140124.orig/gdb/dwarf2read.c 2014-01-24
13:04:04.169111566 +0800
+++ gdb-7.7.50.20140124/gdb/dwarf2read.c 2014-01-24 13:26:48.445122774 +0800
@@ -6769,8 +6769,9 @@ add_partial_symbol (struct partial_die_i
  }
       else
  {
-  /* Static Variable.  Skip symbols without location descriptors.  */
-  if (pdi->d.locdesc == NULL)
+  /* Static Variable.  Skip symbols without location descriptors. or
+      has_type not set. */
+  if (pdi->d.locdesc == NULL && pdi->has_type == 0)
     {
       xfree (built_actual_name);
       return;

3. Change for gdb/testsuite/Changelog

2014-01-24  Jun Gong  <heixia108@gmail.com>

      * gdb.dwarf2/const-var.exp: New file.

4. Test case has been attached as const-var.exp.


Best Regards,

Jun

[-- Attachment #2: const-var.exp --]
[-- Type: application/octet-stream, Size: 1749 bytes --]

# Copyright 2013 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

load_lib dwarf.exp

# This test can only be run on targets which support DWARF-2 and use gas.
if {![dwarf2_support]} {
    return 0
}

standard_testfile main.c .S

# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
    declare_labels int_label

    cu {} {
	compile_unit {{language @DW_LANG_C}} {
	    int_label: base_type {
		{name int}
		{byte_size 4 sdata}
		{encoding @DW_ATE_signed}
	    }

	    DW_TAG_variable {
		{name const_var}
		{type :$int_label}
		{const_value 6 data1}
	    }
	}
    }
}

if  { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
	   object {nodebug}] != "" } {
    return -1
}

if  { [gdb_compile $asm_file ${binfile}2.o object {nodebug}] != "" } {
    return -1
}

if  { [gdb_compile [list ${binfile}1.o ${binfile}2.o] \
	   "${binfile}" executable {}] != "" } {
    return -1
}

clean_restart ${testfile}

if ![runto_main] {
    return -1
}

# Print const variable, test whether it has been added to partial
# symbol table.
gdb_test "print const_var" " = 6" "print const variable"

             reply	other threads:[~2014-01-24  6:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24  6:19 Jun Gong [this message]
2014-01-26  9:15 ` Yao Qi
  -- strict thread matches above, loose matches on Subject: below --
2013-11-01  6:29 hex
2013-11-07 15:41 ` Tom Tromey
2013-10-24  6:59 hex
2013-10-24 20:31 ` Tom Tromey
2013-10-25  7:41   ` hex
2013-10-29 18:34     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAB_AMN4J5Wo+gKsKoJaDPtA_5X7u5ibzPA2cXWQdLF0=Fuw1aQ@mail.gmail.com' \
    --to=heixia108@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox