Hello Ulrich, Thank you for your suggestion. From: Ulrich Weigand Subject: Re: [patch] "single step" atomic instruction sequences as a whole. Date: Thu, 08 Mar 2007 17:15:42 +0100 (CET) > Emi Suzuki wrote: > > I have added a new file, tm-rs6000aix.h, to undef SOFTWARE_SINGLE_STEP_P > > for only that target, but felt somewhat strange about the solution. > > I feel like adding some trick for SOFTWARE_SINGLE_STEP_P to gdbarch.c > > rather than undef'ing it, but no idea has come to mind for now. > > We're trying to get rid of the tm.h files, and do everything strictly > via the gdbarch callbacks. (This is also necessary for multi-arch > debugging.) I'd much prefer a solution that does not add new tm.h > files (or contents). Yes, that's exactly what I really intend, do everything via the gdbarch callbacks. > Why don't we extend the gdbarch_software_single_step call with a return > value? Common code would call the gdbarch routine, but if it returns > a nonzero value, it will fall back to using hardware single step after > all. It's like what the original patchset does for this issue (provided http://sourceware.org/ml/gdb-patches/2006-06/msg00339.html and http://sourceware.org/ml/gdb-patches/2006-06/msg00341.html). I have felt something uncomfortable to them, because it uses SOFTWARE_SINGLE_STEP_P to check both if the target will do software single stepping at the next time it proceed and if the target has done software single stepping after it get stopped. But now I have noticed that calling gdbarch_software_single_step *instead of* SOFTWARE_SINGLE_STEP_P will clear my confusion and avoid adding new tm.h files. I've changed the whole solution like below: * make gdbarch_software_single_step return 1 (means non-zero) if it inserted software single step breakpoint, or return 0. * defined default_software_single_step in arch-utils.c, and make it the default of gdbarch_software_single_step. * call SOFTWARE_SINGLE_STEP instead of SOFTWARE_SINGLE_STEP_P, to check if software single stepping will be done when proceeding. * put an alternative way to check if software single stepping was done when stopped (mainly, it would be checking of singlestep_breakpoint_inserted_p). One thing I am not sure about my change is adjust_pc_after_break in infrun.c. And I am not familier with the use of gdbarch.sh, it is much appreciated if anyone would review them. -- Emi SUZUKI