* lib/dwarf.exp (Dwarf): New proc "tu".
* gdb.dwarf2/missing-sig-type.exp: New file.
This commit is contained in:
parent
ac9ec31b3e
commit
4f22ed5cac
|
@ -1,3 +1,8 @@
|
||||||
|
2013-04-17 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* lib/dwarf.exp (Dwarf): New proc "tu".
|
||||||
|
* gdb.dwarf2/missing-sig-type.exp: New file.
|
||||||
|
|
||||||
2013-04-15 Siva Chandra Reddy <sivachandra@google.com>
|
2013-04-15 Siva Chandra Reddy <sivachandra@google.com>
|
||||||
|
|
||||||
Add option to link testcases with Pthreads library when
|
Add option to link testcases with Pthreads library when
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [skip_cplus_tests] } { continue }
|
||||||
|
|
||||||
|
standard_testfile main.c missing-sig-type-dw4.S
|
||||||
|
|
||||||
|
# Make some DWARF for the test.
|
||||||
|
set asm_file [standard_output_file $srcfile2]
|
||||||
|
Dwarf::assemble $asm_file {
|
||||||
|
cu 0 4 8 {
|
||||||
|
compile_unit {} {
|
||||||
|
declare_labels typedef_label
|
||||||
|
|
||||||
|
# This signature is intentionally wrong.
|
||||||
|
typedef_label: typedef {
|
||||||
|
{name foo}
|
||||||
|
{type 0xee22334455667788 ref_sig8 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tu 0 4 8 0x1122334455667788 the_type {
|
||||||
|
type_unit {} {
|
||||||
|
the_type: base_type {
|
||||||
|
{name int}
|
||||||
|
{encoding @DW_ATE_signed}
|
||||||
|
{byte_size 4 sdata}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {c++}] != ""} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_restart ${testfile}
|
||||||
|
|
||||||
|
gdb_test "ptype foo" "type = <unknown type .*>"
|
|
@ -109,6 +109,9 @@ namespace eval Dwarf {
|
||||||
# The current output file.
|
# The current output file.
|
||||||
variable _output_file
|
variable _output_file
|
||||||
|
|
||||||
|
# Note: The _cu_ values here also apply to type units (TUs).
|
||||||
|
# Think of a TU as a special kind of CU.
|
||||||
|
|
||||||
# Current CU count.
|
# Current CU count.
|
||||||
variable _cu_count
|
variable _cu_count
|
||||||
|
|
||||||
|
@ -699,6 +702,76 @@ namespace eval Dwarf {
|
||||||
define_label $end_label
|
define_label $end_label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Emit a DWARF TU.
|
||||||
|
# IS_64 is a boolean which is true if you want to emit 64-bit
|
||||||
|
# DWARF, and false for 32-bit DWARF.
|
||||||
|
# VERSION is the DWARF version number to emit.
|
||||||
|
# ADDR_SIZE is the size of addresses in bytes.
|
||||||
|
# SIGNATURE is the 64-bit signature of the type.
|
||||||
|
# TYPE_LABEL is the label of the type defined by this TU.
|
||||||
|
# BODY is Tcl code that emits the DIEs which make up the body of
|
||||||
|
# the CU. It is evaluated in the caller's context.
|
||||||
|
proc tu {is_64 version addr_size signature type_label body} {
|
||||||
|
variable _cu_count
|
||||||
|
variable _abbrev_num
|
||||||
|
variable _cu_label
|
||||||
|
variable _cu_version
|
||||||
|
variable _cu_addr_size
|
||||||
|
variable _cu_offset_size
|
||||||
|
|
||||||
|
set _cu_version $version
|
||||||
|
if {$is_64} {
|
||||||
|
set _cu_offset_size 8
|
||||||
|
} else {
|
||||||
|
set _cu_offset_size 4
|
||||||
|
}
|
||||||
|
set _cu_addr_size $addr_size
|
||||||
|
|
||||||
|
_section .debug_types
|
||||||
|
|
||||||
|
set cu_num [incr _cu_count]
|
||||||
|
set my_abbrevs [_compute_label "abbrev${cu_num}_begin"]
|
||||||
|
set _abbrev_num 1
|
||||||
|
|
||||||
|
set _cu_label [_compute_label "cu${cu_num}_begin"]
|
||||||
|
set start_label [_compute_label "cu${cu_num}_start"]
|
||||||
|
set end_label [_compute_label "cu${cu_num}_end"]
|
||||||
|
|
||||||
|
define_label $_cu_label
|
||||||
|
if {$is_64} {
|
||||||
|
_op .4byte 0xffffffff
|
||||||
|
_op .8byte "$end_label - $start_label"
|
||||||
|
} else {
|
||||||
|
_op .4byte "$end_label - $start_label"
|
||||||
|
}
|
||||||
|
define_label $start_label
|
||||||
|
_op .2byte $version Version
|
||||||
|
_op .4byte $my_abbrevs Abbrevs
|
||||||
|
_op .byte $addr_size "Pointer size"
|
||||||
|
_op .8byte $signature Signature
|
||||||
|
uplevel declare_labels $type_label
|
||||||
|
upvar $type_label my_type_label
|
||||||
|
if {$is_64} {
|
||||||
|
_op .8byte "$my_type_label - $_cu_label"
|
||||||
|
} else {
|
||||||
|
_op .4byte "$my_type_label - $_cu_label"
|
||||||
|
}
|
||||||
|
|
||||||
|
_defer_output .debug_abbrev {
|
||||||
|
define_label $my_abbrevs
|
||||||
|
}
|
||||||
|
|
||||||
|
uplevel $body
|
||||||
|
|
||||||
|
_defer_output .debug_abbrev {
|
||||||
|
# Emit the terminator.
|
||||||
|
_op .byte 0x0 Terminator
|
||||||
|
_op .byte 0x0 Terminator
|
||||||
|
}
|
||||||
|
|
||||||
|
define_label $end_label
|
||||||
|
}
|
||||||
|
|
||||||
proc _empty_array {name} {
|
proc _empty_array {name} {
|
||||||
upvar $name the_array
|
upvar $name the_array
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue