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
d3d5f4ce
Commit
d3d5f4ce
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Initial revision
parent
145d1173
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
ldb/breakpoint.c
+104
-0
104 additions, 0 deletions
ldb/breakpoint.c
with
104 additions
and
0 deletions
ldb/breakpoint.c
0 → 100644
+
104
−
0
View file @
d3d5f4ce
#include
<stdio.h>
#include
<signal.h>
#include
"lisp.h"
#include
"os.h"
#include
"lispregs.h"
#include
"globals.h"
#ifdef ibmrt
typedef
unsigned
short
inst
;
#else
typedef
unsigned
long
inst
;
#endif
static
inst
swap_insts
(
code_obj
,
pc_offset
,
new_inst
)
lispobj
code_obj
;
int
pc_offset
;
inst
new_inst
;
{
struct
code
*
code
;
inst
*
addr
,
old_inst
;
code
=
(
struct
code
*
)
PTR
(
code_obj
);
addr
=
(
inst
*
)((
char
*
)
code
+
HeaderValue
(
code
->
header
)
*
sizeof
(
lispobj
)
+
pc_offset
);
old_inst
=
*
addr
;
*
addr
=
new_inst
;
os_flush_icache
((
os_vm_address_t
)
addr
,
sizeof
(
inst
));
return
old_inst
;
}
inst
breakpoint_install
(
code_obj
,
pc_offset
)
lispobj
code_obj
;
int
pc_offset
;
{
return
swap_insts
(
code_obj
,
pc_offset
,
(
trap_Breakpoint
<<
16
)
|
0xd
);
}
void
breakpoint_remove
(
code_obj
,
pc_offset
,
orig_inst
)
lispobj
code_obj
;
int
pc_offset
;
inst
orig_inst
;
{
swap_insts
(
code_obj
,
pc_offset
,
orig_inst
);
}
static
int
calc_offset
(
code
,
pc
)
struct
code
*
code
;
unsigned
long
pc
;
{
unsigned
long
code_start
;
int
offset
;
code_start
=
(
unsigned
long
)
code
+
HeaderValue
(
code
->
header
)
*
sizeof
(
lispobj
);
if
(
pc
<
code_start
)
return
0
;
offset
=
pc
-
code_start
;
if
(
offset
>=
code
->
code_size
)
return
0
;
return
offset
;
}
int
breakpoint_after_offset
(
scp
)
struct
sigcontext
*
scp
;
{
struct
code
*
code
=
(
struct
code
*
)
PTR
(
scp
->
sc_regs
[
CODE
]);
#ifdef sparc
return
calc_offset
(
code
,
scp
->
sc_npc
);
#endif
#ifdef mips
inst
cur_inst
=
*
(
inst
*
)
scp
->
sc_pc
;
int
opcode
=
cur_inst
>>
26
;
struct
sigcontext
tmp
;
if
(
opcode
==
1
||
((
opcode
&
0x3c
)
==
0x4
)
||
((
cur_inst
&
0xf00e0000
)
==
0x80000000
))
{
tmp
=
*
scp
;
emulate_branch
(
&
tmp
,
cur_inst
);
return
calc_offset
(
code
,
tmp
.
sc_pc
);
}
else
return
calc_offset
(
code
,
scp
->
sc_pc
+
4
);
#endif
}
handle_breakpoint
(
signal
,
code
,
scp
)
struct
sigcontext
*
scp
;
{
struct
code
*
code
=
(
struct
code
*
)
PTR
(
scp
->
sc_regs
[
CODE
]);
lispobj
*
args
;
args
=
current_control_stack_pointer
;
current_control_stack_pointer
+=
3
;
args
[
0
]
=
fixnum
(
calc_offset
(
code
,
scp
->
sc_pc
));
args
[
1
]
=
scp
->
sc_regs
[
CODE
];
args
[
2
]
=
alloc_sap
(
scp
);
call_into_lisp
(
HANDLE_BREAKPOINT
,
SymbolFunction
(
HANDLE_BREAKPOINT
),
args
,
3
);
scp
->
sc_mask
=
sigblock
(
0
);
}
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