Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
2f5efbfa
Commit
2f5efbfa
authored
Sep 08, 2020
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libbacktrace: don't strip leading underscore on 64-bit PE
* pecoff.c (coff_initialize_syminfo): Add is_64 parameter. (coff_add): Determine and pass is_64. Closes #28
parent
4ae8d988
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
pecoff.c
pecoff.c
+10
-2
No files found.
pecoff.c
View file @
2f5efbfa
...
@@ -330,7 +330,7 @@ coff_is_function_symbol (const b_coff_internal_symbol *isym)
...
@@ -330,7 +330,7 @@ coff_is_function_symbol (const b_coff_internal_symbol *isym)
static
int
static
int
coff_initialize_syminfo
(
struct
backtrace_state
*
state
,
coff_initialize_syminfo
(
struct
backtrace_state
*
state
,
uintptr_t
base_address
,
uintptr_t
base_address
,
int
is_64
,
const
b_coff_section_header
*
sects
,
size_t
sects_num
,
const
b_coff_section_header
*
sects
,
size_t
sects_num
,
const
b_coff_external_symbol
*
syms
,
size_t
syms_size
,
const
b_coff_external_symbol
*
syms
,
size_t
syms_size
,
const
unsigned
char
*
strtab
,
size_t
strtab_size
,
const
unsigned
char
*
strtab
,
size_t
strtab_size
,
...
@@ -426,9 +426,12 @@ coff_initialize_syminfo (struct backtrace_state *state,
...
@@ -426,9 +426,12 @@ coff_initialize_syminfo (struct backtrace_state *state,
else
else
name
=
isym
.
name
;
name
=
isym
.
name
;
if
(
!
is_64
)
{
/* Strip leading '_'. */
/* Strip leading '_'. */
if
(
name
[
0
]
==
'_'
)
if
(
name
[
0
]
==
'_'
)
name
++
;
name
++
;
}
/* Symbol value is section relative, so we need to read the address
/* Symbol value is section relative, so we need to read the address
of its section. */
of its section. */
...
@@ -605,6 +608,7 @@ coff_add (struct backtrace_state *state, int descriptor,
...
@@ -605,6 +608,7 @@ coff_add (struct backtrace_state *state, int descriptor,
off_t
max_offset
;
off_t
max_offset
;
struct
backtrace_view
debug_view
;
struct
backtrace_view
debug_view
;
int
debug_view_valid
;
int
debug_view_valid
;
int
is_64
;
uintptr_t
image_base
;
uintptr_t
image_base
;
struct
dwarf_sections
dwarf_sections
;
struct
dwarf_sections
dwarf_sections
;
...
@@ -680,12 +684,16 @@ coff_add (struct backtrace_state *state, int descriptor,
...
@@ -680,12 +684,16 @@ coff_add (struct backtrace_state *state, int descriptor,
sects
=
(
const
b_coff_section_header
*
)
sects
=
(
const
b_coff_section_header
*
)
(
sects_view
.
data
+
fhdr
.
size_of_optional_header
);
(
sects_view
.
data
+
fhdr
.
size_of_optional_header
);
is_64
=
0
;
if
(
fhdr
.
size_of_optional_header
>
sizeof
(
*
opt_hdr
))
if
(
fhdr
.
size_of_optional_header
>
sizeof
(
*
opt_hdr
))
{
{
if
(
opt_hdr
->
magic
==
PE_MAGIC
)
if
(
opt_hdr
->
magic
==
PE_MAGIC
)
image_base
=
opt_hdr
->
u
.
pe
.
image_base
;
image_base
=
opt_hdr
->
u
.
pe
.
image_base
;
else
if
(
opt_hdr
->
magic
==
PEP_MAGIC
)
else
if
(
opt_hdr
->
magic
==
PEP_MAGIC
)
{
image_base
=
opt_hdr
->
u
.
pep
.
image_base
;
image_base
=
opt_hdr
->
u
.
pep
.
image_base
;
is_64
=
1
;
}
else
else
{
{
error_callback
(
data
,
"bad magic in PE optional header"
,
0
);
error_callback
(
data
,
"bad magic in PE optional header"
,
0
);
...
@@ -778,7 +786,7 @@ coff_add (struct backtrace_state *state, int descriptor,
...
@@ -778,7 +786,7 @@ coff_add (struct backtrace_state *state, int descriptor,
if
(
sdata
==
NULL
)
if
(
sdata
==
NULL
)
goto
fail
;
goto
fail
;
if
(
!
coff_initialize_syminfo
(
state
,
image_base
,
if
(
!
coff_initialize_syminfo
(
state
,
image_base
,
is_64
,
sects
,
sects_num
,
sects
,
sects_num
,
syms_view
.
data
,
syms_size
,
syms_view
.
data
,
syms_size
,
str_view
.
data
,
str_size
,
str_view
.
data
,
str_size
,
...
...
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