public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] infcall: refactor 'call_function_by_hand_dummy' Date: Thu, 24 Oct 2019 07:22:00 -0000 [thread overview] Message-ID: <12e7c35ec3c09793ed9613cdf696b9f0f4dd86ec@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 12e7c35ec3c09793ed9613cdf696b9f0f4dd86ec *** commit 12e7c35ec3c09793ed9613cdf696b9f0f4dd86ec Author: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> AuthorDate: Wed Oct 23 20:58:42 2019 +0200 Commit: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> CommitDate: Wed Oct 23 20:58:42 2019 +0200 infcall: refactor 'call_function_by_hand_dummy' Extract out the code region that reserves stack space to a separate function. Fix the comment of 'call_function_by_hand_dummy' to remove reference to the NARGS argument that was removed in commit (e71585ffe2e "Use gdb:array_view in call_function_by_hand & friends"). gdb/ChangeLog: 2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * infcall.c (call_function_by_hand_dummy): Fix the function comment. And extract out a code section into... (reserve_stack_space): ...this new function. Change-Id: I8938ef4134aff68a0a21724aaa2406bfe453438a diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 52aea37276..a976d8f9a7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> + + * infcall.c (call_function_by_hand_dummy): Fix the function + comment. And extract out a code section into... + (reserve_stack_space): ...this new function. + 2019-10-23 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * infcall.c (value_arg_coerce): Remove an unused parameter. diff --git a/gdb/infcall.c b/gdb/infcall.c index b83f1bf323..583f0deef0 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -668,6 +668,42 @@ run_inferior_call (struct call_thread_fsm *sm, return caught_error; } +/* Reserve space on the stack for a value of the given type. + Return the address of the allocated space. + Make certain that the value is correctly aligned. + The SP argument is modified. */ + +static CORE_ADDR +reserve_stack_space (const type *values_type, CORE_ADDR &sp) +{ + struct frame_info *frame = get_current_frame (); + struct gdbarch *gdbarch = get_frame_arch (frame); + CORE_ADDR addr = 0; + + if (gdbarch_inner_than (gdbarch, 1, 2)) + { + /* Stack grows downward. Align STRUCT_ADDR and SP after + making space. */ + sp -= TYPE_LENGTH (values_type); + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + addr = sp; + } + else + { + /* Stack grows upward. Align the frame, allocate space, and + then again, re-align the frame??? */ + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + addr = sp; + sp += TYPE_LENGTH (values_type); + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + } + + return addr; +} + /* See infcall.h. */ struct value * @@ -689,7 +725,7 @@ call_function_by_hand (struct value *function, making dummy frames be different from normal frames, consider that. */ /* Perform a function call in the inferior. - ARGS is a vector of values of arguments (NARGS of them). + ARGS is a vector of values of arguments. FUNCTION is a value, the function to be called. Returns a value representing what the function returned. May fail to return, if a breakpoint or signal is hit @@ -989,8 +1025,7 @@ call_function_by_hand_dummy (struct value *function, } /* Reserve space for the return structure to be written on the - stack, if necessary. Make certain that the value is correctly - aligned. + stack, if necessary. While evaluating expressions, we reserve space on the stack for return values of class type even if the language ABI and the target @@ -1005,28 +1040,7 @@ call_function_by_hand_dummy (struct value *function, if (return_method != return_method_normal || (stack_temporaries && class_or_union_p (values_type))) - { - if (gdbarch_inner_than (gdbarch, 1, 2)) - { - /* Stack grows downward. Align STRUCT_ADDR and SP after - making space for the return value. */ - sp -= TYPE_LENGTH (values_type); - if (gdbarch_frame_align_p (gdbarch)) - sp = gdbarch_frame_align (gdbarch, sp); - struct_addr = sp; - } - else - { - /* Stack grows upward. Align the frame, allocate space, and - then again, re-align the frame??? */ - if (gdbarch_frame_align_p (gdbarch)) - sp = gdbarch_frame_align (gdbarch, sp); - struct_addr = sp; - sp += TYPE_LENGTH (values_type); - if (gdbarch_frame_align_p (gdbarch)) - sp = gdbarch_frame_align (gdbarch, sp); - } - } + struct_addr = reserve_stack_space (values_type, sp); std::vector<struct value *> new_args; if (return_method == return_method_hidden_param)
next reply other threads:[~2019-10-24 7:22 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-10-24 7:22 gdb-buildbot [this message] 2019-10-24 7:22 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot 2019-10-24 7:39 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot 2019-10-24 7:53 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot 2019-11-11 14:47 ` Failures on Fedora-i686, " gdb-buildbot 2019-11-11 14:55 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2019-11-11 15:34 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2019-11-11 15:40 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2019-11-11 16:25 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=12e7c35ec3c09793ed9613cdf696b9f0f4dd86ec@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).