From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1983) id E76093858D28; Wed, 18 Jan 2023 16:14:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E76093858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674058470; bh=zE+GTq7LbNOcKuHNgbesSLdmhleHqII4n+zkYBSpw/w=; h=From:To:Subject:Date:From; b=DoQz8PK2699FzdwPXsf7pO+BlEuksnyaw+zG4e9U+RstPqpAkcOUdEthwv+A8A3bJ dLxWlzMCWAVSFo5W0GAJ3kYFdzm2RVL+7vk0C8/N1/zOj5+vYb+rtumq5nUr2oWd/C TUF7V69gmb6JchYeAXNziRcS7c7/783X2dH5v6uI= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Carl Love To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Revert "PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp" X-Act-Checkin: binutils-gdb X-Git-Author: Carl Love X-Git-Refname: refs/heads/master X-Git-Oldrev: 722e0dd9e4f03d66666c5b62e162da31cafe6d9f X-Git-Newrev: 15d2b36c5b60795067cec773a66d2627d2bf9266 Message-Id: <20230118161430.E76093858D28@sourceware.org> Date: Wed, 18 Jan 2023 16:14:30 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D15d2b36c5b60= 795067cec773a66d2627d2bf9266 commit 15d2b36c5b60795067cec773a66d2627d2bf9266 Author: Carl Love Date: Wed Jan 18 11:12:13 2023 -0500 Revert "PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.revers= e/finish-reverse.exp" =20 This reverts commit 92e07580db6a5572573d5177ca23933064158f89. =20 Reverting patch as the patch series is causing regressions. Diff: --- gdb/infcmd.c | 40 ++++------ gdb/infrun.c | 16 +--- gdb/testsuite/gdb.reverse/finish-reverse-next.c | 39 +-------- gdb/testsuite/gdb.reverse/finish-reverse-next.exp | 96 +++----------------= ---- 4 files changed, 31 insertions(+), 160 deletions(-) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 978c07f176d..5fcd2abd983 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1720,25 +1720,22 @@ finish_backward (struct finish_command_fsm *sm) sal =3D find_pc_line (func_addr, 0); =20 frame_info_ptr frame =3D get_selected_frame (nullptr); - struct gdbarch *gdbarch =3D get_frame_arch (frame); - CORE_ADDR alt_entry_point =3D sal.pc; - CORE_ADDR entry_point =3D alt_entry_point; =20 - if (gdbarch_skip_entrypoint_p (gdbarch)) + if (sal.pc !=3D pc) { - /* Some architectures, like PowerPC use local and global entry point= s. - There is only one Entry Point (GEP =3D LEP) for other architectures. - The GEP is an alternate entry point. The LEP is the normal entry - point. The value of entry_point was initialized to the alternate - entry point (GEP). It will be adjusted if the normal entry point - (LEP) was used. */ - entry_point =3D gdbarch_skip_entrypoint (gdbarch, entry_point); - } + struct gdbarch *gdbarch =3D get_frame_arch (frame); =20 - if (alt_entry_point <=3D pc && pc <=3D entry_point) + /* Set a step-resume at the function's entry point. Once that's + hit, we'll do one more step backwards. */ + symtab_and_line sr_sal; + sr_sal.pc =3D sal.pc; + sr_sal.pspace =3D get_frame_program_space (frame); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); + } + else { - /* We are exactly at the function entry point, or between the entry - point on platforms that have two (like PowerPC). Note that this + /* We are exactly at the function entry point. Note that this can only happen at frame #0. =20 When setting a step range, need to call set_step_info @@ -1747,17 +1744,8 @@ finish_backward (struct finish_command_fsm *sm) =20 /* Return using a step range so we will keep stepping back to the first instruction in the source code line. */ - tp->control.step_range_start =3D alt_entry_point; - tp->control.step_range_end =3D entry_point; - } - else - { - symtab_and_line sr_sal; - /* Set a step-resume at the function's entry point. */ - sr_sal.pc =3D entry_point; - sr_sal.pspace =3D get_frame_program_space (frame); - insert_step_resume_breakpoint_at_sal (gdbarch, - sr_sal, null_frame_id); + tp->control.step_range_start =3D sal.pc; + tp->control.step_range_end =3D sal.pc; } proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 9c81521683c..05b150b1b63 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1868,7 +1868,6 @@ struct execution_control_state =20 struct target_waitstatus ws; int stop_func_filled_in =3D 0; - CORE_ADDR stop_func_alt_start =3D 0; CORE_ADDR stop_func_start =3D 0; CORE_ADDR stop_func_end =3D 0; const char *stop_func_name =3D nullptr; @@ -4664,12 +4663,6 @@ fill_in_stop_func (struct gdbarch *gdbarch, &block); ecs->stop_func_name =3D gsi =3D=3D nullptr ? nullptr : gsi->print_na= me (); =20 - /* PowerPC functions have a Local Entry Point and a Global Entry - Point. There is only one Entry Point (GEP =3D LEP) for other - architectures. Save the alternate entry point address (GEP) for - use later. */ - ecs->stop_func_alt_start =3D ecs->stop_func_start; - /* The call to find_pc_partial_function, above, will set stop_func_start and stop_func_end to the start and end of the range containing the stop pc. If this range @@ -4686,9 +4679,6 @@ fill_in_stop_func (struct gdbarch *gdbarch, +=3D gdbarch_deprecated_function_start_offset (gdbarch); =20 if (gdbarch_skip_entrypoint_p (gdbarch)) - /* The PowerPC architecture uses two entry points. Stop at the - regular entry point (LEP on PowerPC) initially. Will setup a - breakpoint for the alternate entry point (GEP) later. */ ecs->stop_func_start =3D gdbarch_skip_entrypoint (gdbarch, ecs->stop_func_start); } @@ -6764,7 +6754,7 @@ process_event_stop_test (struct execution_control_sta= te *ecs) =20 /* Return using a step range so we will keep stepping back to the first instruction in the source code line. */ - tp->control.step_range_start =3D ecs->stop_func_alt_start; + tp->control.step_range_start =3D ecs->stop_func_start; tp->control.step_range_end =3D ecs->stop_func_start; keep_going (ecs); return; @@ -6901,10 +6891,8 @@ process_event_stop_test (struct execution_control_st= ate *ecs) (unless it's the function entry point, in which case keep going back to the call point). */ CORE_ADDR stop_pc =3D ecs->event_thread->stop_pc (); - if (stop_pc =3D=3D ecs->event_thread->control.step_range_start - && (stop_pc < ecs->stop_func_alt_start - || stop_pc > ecs->stop_func_start) + && stop_pc !=3D ecs->stop_func_start && execution_direction =3D=3D EXEC_REVERSE) end_stepping_range (ecs); else diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-next.c b/gdb/testsuit= e/gdb.reverse/finish-reverse-next.c index 0347906961d..f90ecbb93cb 100644 --- a/gdb/testsuite/gdb.reverse/finish-reverse-next.c +++ b/gdb/testsuite/gdb.reverse/finish-reverse-next.c @@ -24,37 +24,11 @@ This test verifies the fix for gdb bugzilla: =20 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29927 - - PowerPC supports two entry points to a function. The normal entry point - is called the local entry point (LEP). The alternat entry point is cal= led - the global entry point (GEP). The GEP is only used if the table of - contents (TOC) value stored in register r2 needs to be setup prior to - execution starting at the LEP. A function call via a function pointer - will entry via the GEP. A normal function call will enter via the LEP. - - This test has been expanded to include tests to verify the reverse-fini= sh - command works properly if the function is called via the GEP. The orig= inal - test only verified the reverse-finish command for a normal call that us= ed - the LEP. */ +*/ =20 int function1 (int a, int b) // FUNCTION1 { - /* The assembly code for this function when compiled for PowerPC is as - follows: - - 0000000010000758 : - 10000758: 02 10 40 3c lis r2,4098 <- GEP - 1000075c: 00 7f 42 38 addi r2,r2,32512 - 10000760: a6 02 08 7c mflr r0 <- LEP - 10000764: 10 00 01 f8 std r0,16(r1) - .... - - When the function is called on PowerPC with function1 (a, b) the call - enters at the Local Entry Point (LEP). When the function is called v= ia - a function pointer, the Global Entry Point (GEP) for function1 is use= d. - The GEP sets up register 2 before reaching the LEP. - */ int ret =3D 0; =20 ret =3D a + b; @@ -65,19 +39,10 @@ int main(int argc, char* argv[]) { int a, b; - int (*funp) (int, int) =3D &function1; - - /* Call function via Local Entry Point (LEP). */ =20 a =3D 1; b =3D 5; =20 - function1 (a, b); // CALL VIA LEP - - /* Call function via Global Entry Point (GEP). */ - a =3D 10; - b =3D 50; - - funp (a, b); // CALL VIA GEP + function1 (a, b); // CALL FUNCTION return 0; } diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-next.exp b/gdb/testsu= ite/gdb.reverse/finish-reverse-next.exp index a9c895dfcd4..63305c109e1 100644 --- a/gdb/testsuite/gdb.reverse/finish-reverse-next.exp +++ b/gdb/testsuite/gdb.reverse/finish-reverse-next.exp @@ -31,16 +31,6 @@ # This test verifies the fix for gdb bugzilla: # https://sourceware.org/bugzilla/show_bug.cgi?id=3D29927 =20 -# PowerPC supports two entry points to a function. The normal entry point -# is called the local entry point (LEP). The alternat entry point is call= ed -# the global entry point (GEP). A function call via a function pointer -# will entry via the GEP. A normal function call will enter via the LEP. -# -# This test has been expanded to include tests to verify the reverse-finish -# command works properly if the function is called via the GEP. The origi= nal -# test only verified the reverse-finish command for a normal call that used -# the LEP. - if ![supports_reverse] { return } @@ -60,30 +50,30 @@ if [supports_process_record] { } =20 =20 -### TEST 1: reverse finish from the entry point instruction (LEP) in -### function1 when called using the normal entry point (LEP). +### TEST 1: reverse finish from the entry point instruction in +### function1. =20 # Set breakpoint at call to function1 in main. -set bp_LEP_test [gdb_get_line_number "CALL VIA LEP" $srcfile] -gdb_breakpoint $srcfile:$bp_LEP_test temporary +set bp_FUNCTION [gdb_get_line_number "CALL FUNCTION" $srcfile] +gdb_breakpoint $srcfile:$bp_FUNCTION temporary =20 # Continue to break point at function1 call in main. gdb_continue_to_breakpoint \ "stopped at function1 entry point instruction to stepi into function" \ - ".*$srcfile:$bp_LEP_test\r\n.*" + ".*$srcfile:$bp_FUNCTION\r\n.*" =20 # stepi until we see "{" indicating we entered function1 -repeat_cmd_until "stepi" "CALL VIA LEP" "{" "stepi into function1 call" +repeat_cmd_until "stepi" "CALL FUNCTION" "{" "stepi into function1 call" =20 -gdb_test "reverse-finish" ".*function1 \\(a, b\\); // CALL VIA LEP.*" \ - "reverse-finish function1 LEP call from LEP " +gdb_test "reverse-finish" ".*function1 \\(a, b\\); // CALL FUNCTION.*" \ + "reverse-finish function1 " =20 # Check to make sure we stopped at the first instruction in the source code # line. It should only take one reverse next command to get to the previo= us # source line. If GDB stops at the last instruction in the source code l= ine # it will take two reverse next instructions to get to the previous source # line. -gdb_test "reverse-next" ".*b =3D 5;.*" "reverse next at b =3D 5, call from= LEP" +gdb_test "reverse-next" ".*b =3D 5;.*" "reverse next at b =3D 5, call from= function" =20 # Clear the recorded log. gdb_test "record stop" "Process record is stopped.*" \ @@ -94,81 +84,21 @@ gdb_test_no_output "record" "turn on process record for= test2" ### TEST 2: reverse finish from the body of function1. =20 # Set breakpoint at call to function1 in main. -gdb_breakpoint $srcfile:$bp_LEP_test temporary +gdb_breakpoint $srcfile:$bp_FUNCTION temporary =20 # Continue to break point at function1 call in main. gdb_continue_to_breakpoint \ "at function1 entry point instruction to step to body of function" \ - ".*$srcfile:$bp_LEP_test\r\n.*" + ".*$srcfile:$bp_FUNCTION\r\n.*" =20 # do a step instruction to get to the body of the function gdb_test "step" ".*int ret =3D 0;.*" "step test 1" =20 -gdb_test "reverse-finish" ".*function1 \\(a, b\\); // CALL VIA LEP.*" \ - "reverse-finish function1 LEP call from function body" +gdb_test "reverse-finish" ".*function1 \\(a, b\\); // CALL FUNCTION.*" \ + "reverse-finish function1 call from function body" =20 # Check to make sure we stopped at the first instruction in the source code # line. It should only take one reverse next command to get to the previo= us # source line. gdb_test "reverse-next" ".*b =3D 5;.*" \ "reverse next at b =3D 5, from function body" - -# Turn off record to clear logs and turn on again -gdb_test "record stop" "Process record is stopped.*" \ - "turn off process record for test2" -gdb_test_no_output "record" "turn on process record for test3" - - -### TEST 3: reverse finish from the alternate entry point instruction (GEP= ) in -### function1 when called using the alternate entry point (GEP). - -# Set breakpoint at call to funp in main. -set bp_GEP_test [gdb_get_line_number "CALL VIA GEP" $srcfile] -gdb_breakpoint $srcfile:$bp_GEP_test temporary - -# Continue to break point at funp call in main. -gdb_continue_to_breakpoint \ - "stopped at function1 entry point instruction to stepi into funp" \ - ".*$srcfile:$bp_GEP_test\r\n.*" - -# stepi until we see "{" indicating we entered function. -repeat_cmd_until "stepi" "CALL VIA GEP" "{" "stepi into funp call" - -gdb_test "reverse-finish" ".*funp \\(a, b\\);.*" \ - "function1 GEP call call from GEP" - -# Check to make sure we stopped at the first instruction in the source code -# line. It should only take one reverse next command to get to the previo= us -# source line. If GDB stops at the last instruction in the source code li= ne -# it will take two reverse next instructions to get to the previous source -# line. -gdb_test "reverse-next" ".*b =3D 50;.*" "reverse next at b =3D 50, call fr= om GEP" - -# Turn off record to clear logs and turn on again -gdb_test "record stop" "Process record is stopped.*" \ - "turn off process record for test3" -gdb_test_no_output "record" "turn on process record for test4" - - -### TEST 4: reverse finish from the body of function 1 when calling using = the -### alternate entrypoint (GEP). -gdb_breakpoint $srcfile:$bp_GEP_test temporary - -# Continue to break point at funp call. -gdb_continue_to_breakpoint \ - "at function1 entry point instruction to step to body of funp call" \ - ".*$srcfile:$bp_GEP_test\r\n.*" - -# Step into body of funp, called via GEP. -gdb_test "step" ".*int ret =3D 0;.*" "step test 2" - -gdb_test "reverse-finish" ".*funp \\(a, b\\);.*" \ - "reverse-finish function1 GEP call, from function body " - -# Check to make sure we stopped at the first instruction in the source code -# line. It should only take one reverse next command to get to the previo= us -# source line. If GDB stops at the last instruction in the source code li= ne -# it will take two reverse next instructions to get to the previous source -# line. -gdb_test "reverse-next" ".*b =3D 50;.*" \ - "reverse next at b =3D 50 from function body"