Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
548945a3
Commit
548945a3
authored
17 years ago
by
cshapiro
Browse files
Options
Downloads
Patches
Plain Diff
Use longs to hold pointer values. Eliminates truncation on 64-bit
systems and a compiler warning on 32-bit systems.
parent
ba775ff3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lisp/backtrace.c
+13
-14
13 additions, 14 deletions
lisp/backtrace.c
with
13 additions
and
14 deletions
lisp/backtrace.c
+
13
−
14
View file @
548945a3
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/backtrace.c,v 1.1
4
200
5
/0
9/15 18:26:51 rtoy
Exp $
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/backtrace.c,v 1.1
5
200
8
/0
3/21 10:41:43 cshapiro
Exp $
*
*
* Simple backtrace facility. More or less from Rob's lisp version.
* Simple backtrace facility. More or less from Rob's lisp version.
*/
*/
...
@@ -257,12 +257,12 @@ stack_pointer_p(unsigned long p)
...
@@ -257,12 +257,12 @@ stack_pointer_p(unsigned long p)
}
}
static
int
static
int
ra_pointer_p
(
unsigned
ra
)
ra_pointer_p
(
unsigned
long
ra
)
{
{
return
ra
>
4096
&&
!
stack_pointer_p
(
ra
);
return
ra
>
4096
&&
!
stack_pointer_p
(
ra
);
}
}
static
unsigned
static
unsigned
long
deref
(
unsigned
long
p
,
int
offset
)
deref
(
unsigned
long
p
,
int
offset
)
{
{
return
*
((
unsigned
long
*
)
p
+
offset
);
return
*
((
unsigned
long
*
)
p
+
offset
);
...
@@ -329,9 +329,9 @@ print_entry_points(struct code *code)
...
@@ -329,9 +329,9 @@ print_entry_points(struct code *code)
/* See also X86-CALL-CONTEXT in code:debug-int. */
/* See also X86-CALL-CONTEXT in code:debug-int. */
static
int
static
int
x86_call_context
(
unsigned
fp
,
unsigned
*
ra
,
unsigned
*
ocfp
)
x86_call_context
(
unsigned
long
fp
,
unsigned
long
*
ra
,
unsigned
long
*
ocfp
)
{
{
unsigned
lisp_ocfp
,
lisp_ra
,
c_ocfp
,
c_ra
;
unsigned
long
lisp_ocfp
,
lisp_ra
,
c_ocfp
,
c_ra
;
int
lisp_valid_p
,
c_valid_p
;
int
lisp_valid_p
,
c_valid_p
;
if
(
!
stack_pointer_p
(
fp
))
if
(
!
stack_pointer_p
(
fp
))
...
@@ -348,7 +348,7 @@ x86_call_context(unsigned fp, unsigned *ra, unsigned *ocfp)
...
@@ -348,7 +348,7 @@ x86_call_context(unsigned fp, unsigned *ra, unsigned *ocfp)
&&
ra_pointer_p
(
c_ra
));
&&
ra_pointer_p
(
c_ra
));
if
(
lisp_valid_p
&&
c_valid_p
)
{
if
(
lisp_valid_p
&&
c_valid_p
)
{
unsigned
lisp_path_fp
,
c_path_fp
,
dummy
;
unsigned
long
lisp_path_fp
,
c_path_fp
,
dummy
;
int
lisp_path_p
=
x86_call_context
(
lisp_ocfp
,
&
lisp_path_fp
,
&
dummy
);
int
lisp_path_p
=
x86_call_context
(
lisp_ocfp
,
&
lisp_path_fp
,
&
dummy
);
int
c_path_p
=
x86_call_context
(
c_ocfp
,
&
c_path_fp
,
&
dummy
);
int
c_path_p
=
x86_call_context
(
c_ocfp
,
&
c_path_fp
,
&
dummy
);
...
@@ -413,8 +413,8 @@ array_of_type_p(lispobj obj, int type)
...
@@ -413,8 +413,8 @@ array_of_type_p(lispobj obj, int type)
struct
compiled_debug_function
*
struct
compiled_debug_function
*
debug_function_from_pc
(
struct
code
*
code
,
unsigned
long
pc
)
debug_function_from_pc
(
struct
code
*
code
,
unsigned
long
pc
)
{
{
unsigned
code_header_len
=
sizeof
(
lispobj
)
*
HeaderValue
(
code
->
header
);
unsigned
long
code_header_len
=
sizeof
(
lispobj
)
*
HeaderValue
(
code
->
header
);
unsigned
offset
=
pc
-
(
unsigned
)
code
-
code_header_len
;
unsigned
long
offset
=
pc
-
(
unsigned
long
)
code
-
code_header_len
;
if
(
LowtagOf
(
code
->
debug_info
)
==
type_InstancePointer
)
{
if
(
LowtagOf
(
code
->
debug_info
)
==
type_InstancePointer
)
{
struct
compiled_debug_info
*
di
struct
compiled_debug_info
*
di
...
@@ -423,7 +423,7 @@ debug_function_from_pc(struct code *code, unsigned long pc)
...
@@ -423,7 +423,7 @@ debug_function_from_pc(struct code *code, unsigned long pc)
if
(
array_of_type_p
(
di
->
function_map
,
type_SimpleVector
))
{
if
(
array_of_type_p
(
di
->
function_map
,
type_SimpleVector
))
{
struct
vector
*
v
=
(
struct
vector
*
)
PTR
(
di
->
function_map
);
struct
vector
*
v
=
(
struct
vector
*
)
PTR
(
di
->
function_map
);
int
i
,
len
=
fixnum_value
(
v
->
length
);
long
i
,
len
=
fixnum_value
(
v
->
length
);
struct
compiled_debug_function
*
df
struct
compiled_debug_function
*
df
=
(
struct
compiled_debug_function
*
)
PTR
(
v
->
data
[
0
]);
=
(
struct
compiled_debug_function
*
)
PTR
(
v
->
data
[
0
]);
...
@@ -433,7 +433,7 @@ debug_function_from_pc(struct code *code, unsigned long pc)
...
@@ -433,7 +433,7 @@ debug_function_from_pc(struct code *code, unsigned long pc)
int
elsewhere_p
=
offset
>=
fixnum_value
(
df
->
elsewhere_pc
);
int
elsewhere_p
=
offset
>=
fixnum_value
(
df
->
elsewhere_pc
);
for
(
i
=
1
;;
i
+=
2
)
{
for
(
i
=
1
;;
i
+=
2
)
{
unsigned
next_pc
;
unsigned
long
next_pc
;
if
(
i
==
len
)
if
(
i
==
len
)
return
((
struct
compiled_debug_function
*
)
return
((
struct
compiled_debug_function
*
)
...
@@ -467,15 +467,14 @@ debug_function_from_pc(struct code *code, unsigned long pc)
...
@@ -467,15 +467,14 @@ debug_function_from_pc(struct code *code, unsigned long pc)
void
void
backtrace
(
int
nframes
)
backtrace
(
int
nframes
)
{
{
unsigned
fp
;
unsigned
long
fp
;
int
i
;
int
i
;
asm
(
"movl %%ebp,%0"
:
"=g"
(
fp
));
asm
(
"movl %%ebp,%0"
:
"=g"
(
fp
));
for
(
i
=
0
;
i
<
nframes
;
++
i
)
{
for
(
i
=
0
;
i
<
nframes
;
++
i
)
{
lispobj
*
p
;
lispobj
*
p
;
unsigned
long
ra
;
unsigned
long
ra
,
next_fp
;
unsigned
next_fp
;
if
(
!
x86_call_context
(
fp
,
&
ra
,
&
next_fp
))
if
(
!
x86_call_context
(
fp
,
&
ra
,
&
next_fp
))
break
;
break
;
...
@@ -495,7 +494,7 @@ backtrace(int nframes)
...
@@ -495,7 +494,7 @@ backtrace(int nframes)
}
else
if
(
p
)
}
else
if
(
p
)
printf
(
"<Not implemented, type = %d>"
,
(
int
)
TypeOf
(
*
p
));
printf
(
"<Not implemented, type = %d>"
,
(
int
)
TypeOf
(
*
p
));
else
else
printf
(
"Foreign fp = 0x%x, ra = 0x%lx"
,
next_fp
,
ra
);
printf
(
"Foreign fp = 0x%
l
x, ra = 0x%lx"
,
next_fp
,
ra
);
putchar
(
'\n'
);
putchar
(
'\n'
);
fp
=
next_fp
;
fp
=
next_fp
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment