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
4061a7e9
Commit
4061a7e9
authored
Jun 25, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow an underscore to match centered dot (rune 00B7), so people don't have to
type a centered dot when debugging. SVN=124460
parent
10296166
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
sym.c
src/libmach_amd64/sym.c
+27
-4
No files found.
src/libmach_amd64/sym.c
View file @
4061a7e9
...
@@ -560,6 +560,29 @@ lookup(char *fn, char *var, Symbol *s)
...
@@ -560,6 +560,29 @@ lookup(char *fn, char *var, Symbol *s)
}
}
/*
* strcmp, but allow '_' to match center dot (rune 00b7 == bytes c2 b7)
*/
int
cdotstrcmp
(
char
*
sym
,
char
*
user
)
{
for
(;;)
{
while
(
*
sym
==
*
user
)
{
if
(
*
sym
++
==
'\0'
)
return
0
;
user
++
;
}
/* unequal - but maybe '_' matches center dot */
if
(
user
[
0
]
==
'_'
&&
(
sym
[
0
]
&
0xFF
)
==
0xc2
&&
(
sym
[
1
]
&
0xFF
)
==
0xb7
)
{
/* '_' matches center dot - advance and continue */
user
++
;
sym
+=
2
;
continue
;
}
break
;
}
return
*
user
-
*
sym
;
}
/*
/*
* find a function by name
* find a function by name
*/
*/
...
@@ -569,7 +592,7 @@ findtext(char *name, Symbol *s)
...
@@ -569,7 +592,7 @@ findtext(char *name, Symbol *s)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
ntxt
;
i
++
)
{
for
(
i
=
0
;
i
<
ntxt
;
i
++
)
{
if
(
strcmp
(
txt
[
i
].
sym
->
name
,
name
)
==
0
)
{
if
(
cdot
strcmp
(
txt
[
i
].
sym
->
name
,
name
)
==
0
)
{
fillsym
(
txt
[
i
].
sym
,
s
);
fillsym
(
txt
[
i
].
sym
,
s
);
s
->
handle
=
(
void
*
)
&
txt
[
i
];
s
->
handle
=
(
void
*
)
&
txt
[
i
];
s
->
index
=
i
;
s
->
index
=
i
;
...
@@ -587,7 +610,7 @@ findglobal(char *name, Symbol *s)
...
@@ -587,7 +610,7 @@ findglobal(char *name, Symbol *s)
long
i
;
long
i
;
for
(
i
=
0
;
i
<
nglob
;
i
++
)
{
for
(
i
=
0
;
i
<
nglob
;
i
++
)
{
if
(
strcmp
(
globals
[
i
]
->
name
,
name
)
==
0
)
{
if
(
cdot
strcmp
(
globals
[
i
]
->
name
,
name
)
==
0
)
{
fillsym
(
globals
[
i
],
s
);
fillsym
(
globals
[
i
],
s
);
s
->
index
=
i
;
s
->
index
=
i
;
return
1
;
return
1
;
...
@@ -622,7 +645,7 @@ findlocvar(Symbol *s1, char *name, Symbol *s2)
...
@@ -622,7 +645,7 @@ findlocvar(Symbol *s1, char *name, Symbol *s2)
tp
=
(
Txtsym
*
)
s1
->
handle
;
tp
=
(
Txtsym
*
)
s1
->
handle
;
if
(
tp
&&
tp
->
locals
)
{
if
(
tp
&&
tp
->
locals
)
{
for
(
i
=
0
;
i
<
tp
->
n
;
i
++
)
for
(
i
=
0
;
i
<
tp
->
n
;
i
++
)
if
(
strcmp
(
tp
->
locals
[
i
]
->
name
,
name
)
==
0
)
{
if
(
cdot
strcmp
(
tp
->
locals
[
i
]
->
name
,
name
)
==
0
)
{
fillsym
(
tp
->
locals
[
i
],
s2
);
fillsym
(
tp
->
locals
[
i
],
s2
);
s2
->
handle
=
(
void
*
)
tp
;
s2
->
handle
=
(
void
*
)
tp
;
s2
->
index
=
tp
->
n
-
1
-
i
;
s2
->
index
=
tp
->
n
-
1
-
i
;
...
@@ -1166,7 +1189,7 @@ symcomp(const void *a, const void *b)
...
@@ -1166,7 +1189,7 @@ symcomp(const void *a, const void *b)
i
=
(
*
(
Sym
**
)
a
)
->
value
-
(
*
(
Sym
**
)
b
)
->
value
;
i
=
(
*
(
Sym
**
)
a
)
->
value
-
(
*
(
Sym
**
)
b
)
->
value
;
if
(
i
)
if
(
i
)
return
i
;
return
i
;
return
strcmp
((
*
(
Sym
**
)
a
)
->
name
,
(
*
(
Sym
**
)
b
)
->
name
);
return
cdot
strcmp
((
*
(
Sym
**
)
a
)
->
name
,
(
*
(
Sym
**
)
b
)
->
name
);
}
}
/*
/*
...
...
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