Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
a4d09c2a
Commit
a4d09c2a
authored
Sep 24, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Size method to dwarf.Type
R=r DELTA=30 (24 added, 3 deleted, 3 changed) OCL=34950 CL=34974
parent
12fc2173
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
type.go
src/pkg/debug/dwarf/type.go
+27
-6
No files found.
src/pkg/debug/dwarf/type.go
View file @
a4d09c2a
...
...
@@ -13,6 +13,14 @@ import (
"strconv"
;
)
// A Type conventionally represents a pointer to any of the
// specific Type structures (CharType, StructType, etc.).
type
Type
interface
{
Common
()
*
CommonType
;
String
()
string
;
Size
()
int64
;
}
// A CommonType holds fields common to multiple types.
// If a field is not known or not applicable for a given type,
// the zero value is used.
...
...
@@ -25,6 +33,10 @@ func (c *CommonType) Common() *CommonType {
return
c
;
}
func
(
c
*
CommonType
)
Size
()
int64
{
return
c
.
ByteSize
;
}
// Basic types
// A BasicType holds fields common to all basic types.
...
...
@@ -98,6 +110,10 @@ func (t *QualType) String() string {
return
t
.
Qual
+
" "
+
t
.
Type
.
String
();
}
func
(
t
*
QualType
)
Size
()
int64
{
return
t
.
Type
.
Size
();
}
// An ArrayType represents a fixed size array type.
type
ArrayType
struct
{
CommonType
;
...
...
@@ -110,6 +126,10 @@ func (t *ArrayType) String() string {
return
"["
+
strconv
.
Itoa64
(
t
.
Count
)
+
"]"
+
t
.
Type
.
String
();
}
func
(
t
*
ArrayType
)
Size
()
int64
{
return
t
.
Count
*
t
.
Type
.
Size
();
}
// A VoidType represents the C void type.
type
VoidType
struct
{
CommonType
;
...
...
@@ -252,11 +272,8 @@ func (t *TypedefType) String() string {
return
t
.
Name
;
}
// A Type conventionally represents a pointer to any of the
// specific Type structures (CharType, StructType, etc.).
type
Type
interface
{
Common
()
*
CommonType
;
String
()
string
;
func
(
t
*
TypedefType
)
Size
()
int64
{
return
t
.
Type
.
Size
();
}
func
(
d
*
Data
)
Type
(
off
Offset
)
(
Type
,
os
.
Error
)
{
...
...
@@ -589,7 +606,11 @@ func (d *Data) Type(off Offset) (Type, os.Error) {
goto
Error
;
}
typ
.
Common
()
.
ByteSize
,
_
=
e
.
Val
(
AttrByteSize
)
.
(
int64
);
b
,
ok
:=
e
.
Val
(
AttrByteSize
)
.
(
int64
);
if
!
ok
{
b
=
-
1
;
}
typ
.
Common
()
.
ByteSize
=
b
;
return
typ
,
nil
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment