1999-04-16 01:35:26 +00:00
|
|
|
.include "common.inc"
|
|
|
|
.include "arch.inc"
|
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "WARNING: asm-source.exp checks for line numbers printed by gdb."
|
|
|
|
comment "Be careful about changing this file without also changing"
|
|
|
|
comment "asm-source.exp."
|
2000-07-04 02:47:08 +00:00
|
|
|
|
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "This file is not linked with crt0."
|
|
|
|
comment "Provide very simplistic equivalent."
|
2000-07-04 02:47:08 +00:00
|
|
|
|
|
|
|
.global _start
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_declare _start
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_startup
|
|
|
|
gdbasm_call main
|
|
|
|
gdbasm_exit0
|
2002-10-22 01:43:37 +00:00
|
|
|
gdbasm_end _start
|
2000-07-04 02:47:08 +00:00
|
|
|
|
Implement displaced stepping.
gdb/
* gdbarch.sh (max_insn_length): New 'variable'.
(displaced_step_copy, displaced_step_fixup)
(displaced_step_free_closure, displaced_step_location): New
functions.
(struct displaced_step_closure): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* arch-utils.c: #include "objfiles.h".
(simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New functions.
* arch-utils.h (simple_displaced_step_copy_insn)
(simple_displaced_step_free_closure)
(displaced_step_at_entry_point): New prototypes.
* i386-tdep.c (I386_MAX_INSN_LEN): Rename to...
(I386_MAX_MATCHED_INSN_LEN): ... this.
(i386_absolute_jmp_p, i386_absolute_call_p)
(i386_ret_p, i386_call_p, i386_breakpoint_p, i386_syscall_p)
(i386_displaced_step_fixup): New functions.
(struct i386_insn, i386_match_insn): Update.
(i386_gdbarch_init): Set gdbarch_max_insn_length.
* i386-tdep.h (I386_MAX_INSN_LEN): New.
(i386_displaced_step_fixup): New prototype.
* i386-linux-tdep.c (i386_linux_init_abi): Include "arch-utils.h".
Register gdbarch_displaced_step_copy,
gdbarch_displaced_step_fixup, gdbarch_displaced_step_free_closure,
and gdbarch_displaced_step_location functions.
* infrun.c (debug_displaced): New variable.
(show_debug_displaced): New function.
(struct displaced_step_request): New struct.
(displaced_step_request_queue, displaced_step_ptid)
(displaced_step_gdbarch, displaced_step_closure)
(displaced_step_original, displaced_step_copy)
(displaced_step_saved_copy, can_use_displaced_stepping): New
variables.
(show_can_use_displaced_stepping, use_displaced_stepping)
(displaced_step_clear, cleanup_displaced_step_closure)
(displaced_step_dump_bytes, displaced_step_prepare)
(displaced_step_clear_cleanup, write_memory_ptid)
(displaced_step_fixup): New functions.
(resume): Call displaced_step_prepare.
(proceed): Call read_pc once, and remember the value. If using
displaced stepping, don't remove breakpoints.
(handle_inferior_event): Call displaced_step_fixup. Add some
debugging output. When we try to step over a breakpoint, but get
a signal to deliver to the thread instead, ensure the step-resume
breakpoint is actually inserted. If a thread hop is needed, and
displaced stepping is enabled, don't remove breakpoints.
(init_wait_for_inferior): Call displaced_step_clear.
(_initialize_infrun): Add "set debug displaced" command. Add
"maint set can-use-displaced-stepping" command. Clear
displaced_step_ptid.
* inferior.h (debug_displaced): Declare variable.
(displaced_step_dump_bytes): Declare function.
* Makefile.in (arch-utils.o, i386-linux-tdep.o): Update
dependencies.
gdb/testsuite/
* gdb.asm/asmsrc1.s: Add scratch space.
gdb/doc/
* gdb.texinfo (Debugging Output): Document "set/show debug
displaced".
(Maintenance Commands): Document "maint set/show
can-use-displaced-stepping".
2008-05-02 16:49:54 +00:00
|
|
|
comment "Displaced stepping requires scratch space at _start"
|
|
|
|
comment "at least as large as the largest instruction. No"
|
|
|
|
comment "breakpoints should be set within the scratch space."
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
gdbasm_several_nops
|
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "main routine for assembly source debugging test"
|
|
|
|
comment "This particular testcase uses macros in <arch>.inc to achieve"
|
|
|
|
comment "machine independence."
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
.global main
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_declare main
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_enter
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "Call a macro that consists of several lines of assembler code."
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2007-12-22 06:44:28 +00:00
|
|
|
comment "mark: main start"
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_several_nops
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "Call a subroutine in another file."
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2007-12-22 06:44:28 +00:00
|
|
|
comment "mark: call foo2"
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_call foo2
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "All done."
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2007-12-22 06:44:28 +00:00
|
|
|
comment "mark: main exit"
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_exit0
|
2002-10-22 01:43:37 +00:00
|
|
|
gdbasm_end main
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2007-12-22 06:44:28 +00:00
|
|
|
comment "mark: search"
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "A routine for foo2 to call."
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
.global foo3
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_declare foo3
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_enter
|
2007-12-22 06:44:28 +00:00
|
|
|
comment "mark: foo3 start"
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_leave
|
2002-10-22 01:43:37 +00:00
|
|
|
gdbasm_end foo3
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
.global exit
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_declare exit
|
2001-11-10 17:55:48 +00:00
|
|
|
gdbasm_exit0
|
2002-10-22 01:43:37 +00:00
|
|
|
gdbasm_end exit
|
2001-12-04 19:45:57 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "A static function"
|
2001-12-04 19:45:57 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_declare foostatic
|
2001-12-04 19:45:57 +00:00
|
|
|
gdbasm_enter
|
|
|
|
gdbasm_leave
|
2002-10-22 01:43:37 +00:00
|
|
|
gdbasm_end foostatic
|
2001-12-04 19:45:57 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "A global variable"
|
2001-12-04 19:45:57 +00:00
|
|
|
|
|
|
|
.global globalvar
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_datavar globalvar 11
|
2001-12-04 19:45:57 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
comment "A static variable"
|
2001-12-04 19:45:57 +00:00
|
|
|
|
2005-12-09 11:02:09 +00:00
|
|
|
gdbasm_datavar staticvar 5
|
2003-11-29 13:55:17 +00:00
|
|
|
|
|
|
|
.include "note.inc"
|