Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
1ad1044b
Commit
1ad1044b
authored
Jun 13, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hack to find first instruction for decoding the pc/line table properly.
SVN=122792
parent
34691ccd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
src/libmach_amd64/sym.c
src/libmach_amd64/sym.c
+10
-1
No files found.
src/libmach_amd64/sym.c
View file @
1ad1044b
...
...
@@ -83,6 +83,7 @@ static Sym *symbols; /* symbol table */
static
Txtsym
*
txt
;
/* Base of text symbol table */
static
uvlong
txtstart
;
/* start of text segment */
static
uvlong
txtend
;
/* end of text segment */
static
uvlong
firstinstr
;
/* as found from symtab; needed for amd64 */
static
void
cleansyms
(
void
);
static
long
decodename
(
Biobuf
*
,
Sym
*
);
...
...
@@ -385,6 +386,7 @@ buildtbls(void)
return
1
;
isbuilt
=
1
;
/* allocate the tables */
firstinstr
=
0
;
if
(
nglob
)
{
globals
=
malloc
(
nglob
*
sizeof
(
*
globals
));
if
(
!
globals
)
{
...
...
@@ -428,6 +430,7 @@ buildtbls(void)
hp
=
hist
;
ap
=
autos
;
for
(
p
=
symbols
;
i
--
>
0
;
p
++
)
{
//print("sym %d type %c name %s value %llux\n", p-symbols, p->type, p->name, p->value);
switch
(
p
->
type
)
{
case
'D'
:
case
'd'
:
...
...
@@ -474,6 +477,8 @@ buildtbls(void)
tp
->
locals
=
ap
;
if
(
debug
)
print
(
"TEXT: %s at %llux
\n
"
,
p
->
name
,
p
->
value
);
if
(
firstinstr
==
0
||
p
->
value
<
firstinstr
)
firstinstr
=
p
->
value
;
if
(
f
&&
!
f
->
sym
)
{
/* first */
f
->
sym
=
p
;
f
->
addr
=
p
->
value
;
...
...
@@ -1045,6 +1050,7 @@ fileline(char *str, int n, uvlong dot)
bot
=
mid
;
else
{
line
=
pc2line
(
dot
);
print
(
"line %d
\n
"
,
line
);
if
(
line
>
0
&&
fline
(
str
,
n
,
line
,
f
->
hist
,
0
)
>=
0
)
return
1
;
break
;
...
...
@@ -1269,7 +1275,10 @@ pc2line(uvlong pc)
if
(
pcline
==
0
)
return
-
1
;
currline
=
0
;
currpc
=
txtstart
-
mach
->
pcquant
;
if
(
firstinstr
!=
0
)
currpc
=
firstinstr
-
mach
->
pcquant
;
else
currpc
=
txtstart
-
mach
->
pcquant
;
if
(
pc
<
currpc
||
pc
>
txtend
)
return
~
0
;
...
...
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