From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id I9pIKdbZIWpvxzQAWB0awg (envelope-from ) for ; Thu, 04 Jun 2026 16:02:30 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=euoA9RuF; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3AX51V30; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=IpXZiEzm; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SYGuTDoC; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 976181E062; Thu, 04 Jun 2026 16:02:30 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BC4681E062 for ; Thu, 04 Jun 2026 16:02:28 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38DA04BA2E18 for ; Thu, 4 Jun 2026 20:02:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38DA04BA2E18 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=euoA9RuF; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3AX51V30; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=IpXZiEzm; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SYGuTDoC Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 361CA4BA5439 for ; Thu, 4 Jun 2026 20:01:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 361CA4BA5439 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 361CA4BA5439 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780603308; cv=none; b=aFtiNwP02T5m8YbDLGYYNOofWcbHAgTawhMNTXucmUn3kvtsEco36w34SHjtyodZa/75pz5bsZ30E31dc68SpzMRdh4VgZk5h3Do5G0HZdk4vHNl3aki6l0g4TNhD+wg5g5hrj9Fi2dL2So9+G8/08VEUaaKW4B67vxjqRUogAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780603308; c=relaxed/simple; bh=0RjQOCuUl7KlF9mOgIXtUk0YFYncj/cdbMIy3wn4UFM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=nscBFGeVXpZpKxn3L0c7g2+9CBGXNF1vTSEmdxw91iPsk0ymIk6w1vMvJ7wCVzKkB9BuFz8XgWzEXNOsKevTGSEpsiJpvcxKMFBVuaIupeXLP+VplvqCj28LRi1cCdetdi13Vh9nugUybLpYdN2keIdY+MSerLpL/LwcFmDmh74= ARC-Authentication-Results: i=1; sourceware.org; dkim=fail (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=euoA9RuF reason="signature verification failed"; dkim=fail header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=3AX51V30 reason="signature verification failed"; dkim=fail (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=IpXZiEzm reason="signature verification failed"; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SYGuTDoC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 361CA4BA5439 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D072A6AB47 for ; Thu, 4 Jun 2026 20:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780603307; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=h7duq+v/fHt3ewgHuXTmdFO4TYPS10LrAvJbY08dj5o=; b=euoA9RuFxUa4A+huzwA+OIuwtmDtsdrKbGSHDWz9W2Y/ZiI9I/BVUJm+OjeQpcBh0h+Hr/ 55gdX/+a7Bonc5zAlXtos1tTaqPlfUT3aINTGci+5cTAmfK29Zr6KHuPn3+FwEDaszWNrH yn/LzuDjFH0Vokm+ASLFRKVRBH0/Aao= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780603307; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=h7duq+v/fHt3ewgHuXTmdFO4TYPS10LrAvJbY08dj5o=; b=3AX51V30mHw+XxOtnjRVitnpfNPoOeL4HAXESVwjbdDOV8TaQX7Q/ZLgrt+lxUQKDW0Y7m lbocpuveametvLAA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=IpXZiEzm; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=SYGuTDoC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780603305; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=h7duq+v/fHt3ewgHuXTmdFO4TYPS10LrAvJbY08dj5o=; b=IpXZiEzmV5qRbYy0wD2j/oV12UiZdXHQGWxPXslRhGKXRGtc7gXuhVJWrXYZbKpJb8wi/+ CERp/HVMBTg1Y3dDf8ruBqPXGFW2XQFITUlWis+rJCwV4KFa/vGrwcfSnDxHd22g4X6qfq 30AWWDcCRW3/5d+itFTTYCDbFYWBhUw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780603305; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=h7duq+v/fHt3ewgHuXTmdFO4TYPS10LrAvJbY08dj5o=; b=SYGuTDoCm7zdvH9xHnrzM3t4HzWJy5pVwEZX+/v7b4qFoq8L3ycQOZQCv7r59psVah157k dB+kWpRgN3Ba7fBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B666C779A8 for ; Thu, 4 Jun 2026 20:01:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id IB81K6nZIWoFLgAAD6G6ig (envelope-from ) for ; Thu, 04 Jun 2026 20:01:45 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb] Drop nullptr in "get_selected_frame (nullptr)" Date: Thu, 4 Jun 2026 22:01:45 +0200 Message-ID: <20260604200145.317344-1-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Queue-Id: D072A6AB47 X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:dkim] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org I came across "get_selected_frame (nullptr)", and realized nullptr is the default argument, so this can be simplified to "get_selected_frame ()". Do so using the following script: ... $ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \ | xargs sed -i 's/get_selected_frame (nullptr)/get_selected_frame ()/' ... and likewise for "get_selected_frame (NULL)". Tested on x86_64-linux. --- gdb/ada-lang.c | 2 +- gdb/ada-tasks.c | 6 +++--- gdb/arch-utils.c | 2 +- gdb/breakpoint.c | 4 ++-- gdb/bsd-kvm.c | 6 +++--- gdb/cli/cli-cmds.c | 2 +- gdb/compile/compile-c-symbols.c | 2 +- gdb/compile/compile-cplus-symbols.c | 2 +- gdb/compile/compile-loc2c.c | 2 +- gdb/compile/compile.c | 4 ++-- gdb/corelow.c | 2 +- gdb/dwarf2/loc.c | 2 +- gdb/eval.c | 2 +- gdb/frame.c | 2 +- gdb/infcmd.c | 12 ++++++------ gdb/infrun.c | 2 +- gdb/language.c | 4 ++-- gdb/mi/mi-cmd-stack.c | 6 +++--- gdb/mi/mi-interp.c | 2 +- gdb/mi/mi-main.c | 10 +++++----- gdb/namespace.c | 2 +- gdb/printcmd.c | 2 +- gdb/record-btrace.c | 2 +- gdb/record-full.c | 4 ++-- gdb/stack.c | 6 +++--- gdb/thread.c | 4 ++-- gdb/tracepoint.c | 2 +- gdb/tui/tui-hooks.c | 4 ++-- gdb/tui/tui-regs.c | 2 +- gdb/tui/tui-source.c | 2 +- gdb/varobj.c | 4 ++-- 31 files changed, 55 insertions(+), 55 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index cb741647d47..bb044e2c5a0 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13167,7 +13167,7 @@ ada_exceptions_list_1 (compiled_regex *preg) if (has_stack_frames ()) { prev_len = result.size (); - ada_add_exceptions_from_frame (preg, get_selected_frame (NULL), + ada_add_exceptions_from_frame (preg, get_selected_frame (), &result); if (result.size () > prev_len) sort_remove_dups_ada_exceptions_list (&result, prev_len); diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 6bd6600b802..f55afcc915d 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -1382,11 +1382,11 @@ task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf) task_to_str (taskno, task_info).c_str ()); switch_to_thread (tp); - ada_find_printable_frame (get_selected_frame (NULL)); + ada_find_printable_frame (get_selected_frame ()); gdb_printf (_("[Switching to task %s]\n"), task_to_str (taskno, task_info).c_str ()); - print_stack_frame (get_selected_frame (NULL), - frame_relative_level (get_selected_frame (NULL)), + print_stack_frame (get_selected_frame (), + frame_relative_level (get_selected_frame ()), SRC_AND_LOC, 1); } diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 5e15fa5b434..e959788bd3b 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -844,7 +844,7 @@ struct gdbarch * get_current_arch (void) { if (has_stack_frames ()) - return get_frame_arch (get_selected_frame (NULL)); + return get_frame_arch (get_selected_frame ()); else return current_inferior ()->arch (); } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 101dc57ee6b..199b52433b3 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2295,7 +2295,7 @@ update_watchpoint (struct watchpoint *b, bool reparse) if (b->exp_valid_block == nullptr) wp_pspace = current_program_space; else - wp_pspace = get_frame_program_space (get_selected_frame (NULL)); + wp_pspace = get_frame_program_space (get_selected_frame ()); /* Look at each value on the value chain. */ gdb_assert (!val_chain.empty ()); @@ -10981,7 +10981,7 @@ until_break_command (const char *arg, int from_tty, int anywhere) may need to switch threads), so do any frame handling before that. */ - frame = get_selected_frame (NULL); + frame = get_selected_frame (); frame_gdbarch = get_frame_arch (frame); stack_frame_id = get_stack_frame_id (frame); caller_frame_id = frame_unwind_caller_id (frame); diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index ca7aed7ec42..3cf217b88a4 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -137,7 +137,7 @@ bsd_kvm_target_open (const char *arg, int from_tty) target_fetch_registers (get_thread_regcache (thr), -1); reinit_frame_cache (); - print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC, 1); } void @@ -335,7 +335,7 @@ bsd_kvm_proc_cmd (const char *arg, int fromtty) target_fetch_registers (get_thread_regcache (inferior_thread ()), -1); reinit_frame_cache (); - print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC, 1); } #endif @@ -355,7 +355,7 @@ bsd_kvm_pcb_cmd (const char *arg, int fromtty) target_fetch_registers (get_thread_regcache (inferior_thread ()), -1); reinit_frame_cache (); - print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC, 1); } bool diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 63f5a637697..3abb2f136ec 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1310,7 +1310,7 @@ list_command (const char *arg, int from_tty) { /* Find the current line by getting the PC of the currently selected frame, and finding the line associated to it. */ - frame_info_ptr frame = get_selected_frame (nullptr); + frame_info_ptr frame = get_selected_frame (); CORE_ADDR curr_pc = get_frame_pc (frame); cursal = find_sal_for_pc (curr_pc, 0); diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index dc0487d8f82..09bf22bacff 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -147,7 +147,7 @@ convert_one_symbol (compile_c_instance *context, if (symbol_read_needs_frame (sym.symbol)) { - frame = get_selected_frame (NULL); + frame = get_selected_frame (); if (frame == NULL) error (_("Symbol \"%s\" cannot be used because " "there is no selected frame"), diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index bc582ffb511..779e66d3073 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -143,7 +143,7 @@ convert_one_symbol (compile_cplus_instance *instance, if (symbol_read_needs_frame (sym.symbol)) { - frame = get_selected_frame (nullptr); + frame = get_selected_frame (); if (frame == nullptr) error (_("Symbol \"%s\" cannot be used because " "there is no selected frame"), diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index 9f189ef1cc7..5e208a86563 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -632,7 +632,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, offset by hand seemed too hackish. */ if (is_tls) { - frame_info_ptr frame = get_selected_frame (NULL); + frame_info_ptr frame = get_selected_frame (); struct value *val; if (frame == NULL) diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index c0b548fefd8..b52859b4bc8 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -437,7 +437,7 @@ show_compile_gcc (struct ui_file *file, int from_tty, static const char * get_selected_pc_producer_options (void) { - CORE_ADDR pc = get_frame_pc (get_selected_frame (NULL)); + CORE_ADDR pc = get_frame_pc (get_selected_frame ()); struct compunit_symtab *symtab = find_compunit_symtab_for_pc (pc); const char *cs; @@ -584,7 +584,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string, "work.")); expr_block = get_expr_block_and_pc (&trash_pc); - expr_pc = get_frame_address_in_block (get_selected_frame (NULL)); + expr_pc = get_frame_address_in_block (get_selected_frame ()); /* Set up instance and context for the compiler. */ std::unique_ptr compiler diff --git a/gdb/corelow.c b/gdb/corelow.c index 819e7cae6f9..d5a724ab551 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -1252,7 +1252,7 @@ core_target_open (const char *arg, int from_tty) /* Now, set up the frame cache, and print the top of stack. */ reinit_frame_cache (); - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC, 1); /* Current thread should be NUM 1 but the user does not know that. If a program is single threaded gdb in general does not mention diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 5bf863e13d5..8e2b401ba34 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -1639,7 +1639,7 @@ dwarf2_evaluate_property (const dynamic_prop *prop, frame_info_ptr frame = initial_frame; if (frame == NULL && has_stack_frames ()) - frame = get_selected_frame (NULL); + frame = get_selected_frame (); switch (prop->kind ()) { diff --git a/gdb/eval.c b/gdb/eval.c index a00774bda3d..7e07765c9e6 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1088,7 +1088,7 @@ eval_op_var_entry_value (struct type *expect_type, struct expression *exp, error (_("Symbol \"%s\" does not have any specific entry value"), sym->print_name ()); - frame_info_ptr frame = get_selected_frame (NULL); + frame_info_ptr frame = get_selected_frame (); return computed_ops->read_variable_at_entry (sym, frame); } diff --git a/gdb/frame.c b/gdb/frame.c index 179e251eb1f..f64f5554f8c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1975,7 +1975,7 @@ deprecated_safe_get_selected_frame (void) { if (!has_stack_frames ()) return NULL; - return get_selected_frame (NULL); + return get_selected_frame (); } /* Invalidate the selected frame. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index f3f15c9ae1d..bd5dbb02f48 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1817,7 +1817,7 @@ finish_backward (struct finish_command_fsm *sm) CORE_ADDR func_addr; CORE_ADDR alt_entry_point; CORE_ADDR entry_point; - frame_info_ptr frame = get_selected_frame (nullptr); + frame_info_ptr frame = get_selected_frame (); struct gdbarch *gdbarch = get_frame_arch (frame); pc = get_frame_pc (get_current_frame ()); @@ -1983,7 +1983,7 @@ finish_command (const char *arg, int from_tty) if (from_tty) { gdb_printf (_("Run till exit from ")); - print_stack_frame (get_selected_frame (nullptr), 1, LOCATION, 0); + print_stack_frame (get_selected_frame (), 1, LOCATION, 0); } proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT); @@ -1991,7 +1991,7 @@ finish_command (const char *arg, int from_tty) } /* Find the function we will return from. */ - frame_info_ptr callee_frame = get_selected_frame (nullptr); + frame_info_ptr callee_frame = get_selected_frame (); sm->function = find_symbol_for_pc (get_frame_pc (callee_frame)); sm->return_buf = 0; /* Initialize buffer address is not available. */ @@ -2523,7 +2523,7 @@ registers_info (const char *addr_exp, bool fpregs) if (!target_has_registers ()) error (_("The program has no registers now.")); - frame = get_selected_frame (nullptr); + frame = get_selected_frame (); gdbarch = get_frame_arch (frame); if (!addr_exp) @@ -2660,7 +2660,7 @@ info_vector_command (const char *args, int from_tty) if (!target_has_registers ()) error (_("The program has no registers now.")); - print_vector_info (gdb_stdout, get_selected_frame (nullptr), args); + print_vector_info (gdb_stdout, get_selected_frame (), args); } /* Kill the inferior process. Make us have no inferior. */ @@ -3197,7 +3197,7 @@ info_float_command (const char *args, int from_tty) if (!target_has_registers ()) error (_("The program has no registers now.")); - frame = get_selected_frame (nullptr); + frame = get_selected_frame (); gdbarch_print_float_info (get_frame_arch (frame), gdb_stdout, frame, args); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 11c5d5214d6..22a05608486 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -9457,7 +9457,7 @@ print_stop_location (const target_waitstatus &ws) /* Function bpstat_print selects the frame to print. Typically, that is the stop frame, in other words get_current_frame (). But bpstat_print may select a different frame, see for instance ada_catchpoint::print_it. */ - frame_info_ptr print_frame = get_selected_frame (nullptr); + frame_info_ptr print_frame = get_selected_frame (); switch (bpstat_ret) { diff --git a/gdb/language.c b/gdb/language.c index 439ef293622..31213577052 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -174,7 +174,7 @@ show_language_command (struct ui_file *file, int from_tty, { frame_info_ptr frame; - frame = get_selected_frame (NULL); + frame = get_selected_frame (); flang = get_frame_language (frame); if (flang != language_unknown && language_mode == language_mode_manual @@ -200,7 +200,7 @@ set_language (const char *language) { frame_info_ptr frame; - frame = get_selected_frame (NULL); + frame = get_selected_frame (); flang = get_frame_language (frame); } catch (const gdb_exception_error &ex) diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 3281be2b4dc..280a08d121e 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -262,7 +262,7 @@ mi_cmd_stack_list_locals (const char *command, const char *const *argv, error (_("-stack-list-locals: Usage: [--no-frame-filters] " "[--skip-unavailable] PRINT_VALUES")); - frame = get_selected_frame (NULL); + frame = get_selected_frame (); print_value = mi_parse_print_values (argv[oind]); if (! raw_arg && frame_filters) @@ -456,7 +456,7 @@ mi_cmd_stack_list_variables (const char *command, const char *const *argv, error (_("-stack-list-variables: Usage: [--no-frame-filters] " \ "[--skip-unavailable] PRINT_VALUES")); - frame = get_selected_frame (NULL); + frame = get_selected_frame (); print_value = mi_parse_print_values (argv[oind]); if (! raw_arg && frame_filters) @@ -762,5 +762,5 @@ mi_cmd_stack_info_frame (const char *command, const char *const *argv, error (_("-stack-info-frame: No arguments allowed")); print_frame_info (user_frame_print_options, - get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1); + get_selected_frame (), 1, LOC_AND_ADDRESS, 0, 1); } diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 8b3048c5a46..1a0d34106ed 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -861,7 +861,7 @@ mi_interp::on_user_selected_context_changed (user_selected_what selection) if (tp->state () != THREAD_RUNNING) { if (has_stack_frames ()) - print_stack_frame_to_uiout (mi_uiout, get_selected_frame (NULL), + print_stack_frame_to_uiout (mi_uiout, get_selected_frame (), 1, SRC_AND_LOC, 1); } } diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 52e642e1464..73c64b82186 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -225,7 +225,7 @@ mi_cmd_exec_return (const char *command, const char *const *argv, int argc) /* Because we have called return_command with from_tty = 0, we need to print the frame here. */ - print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1); + print_stack_frame (get_selected_frame (), 1, LOC_AND_ADDRESS, 1); } void @@ -880,7 +880,7 @@ mi_cmd_data_list_changed_registers (const char *command, contents. */ prev_regs = std::move (this_regs); - this_regs = frame_save_as_regcache (get_selected_frame (NULL)); + this_regs = frame_save_as_regcache (get_selected_frame ()); /* Note that the test for a valid register must include checking the gdbarch_register_name because gdbarch_num_regs may be allocated @@ -1014,7 +1014,7 @@ mi_cmd_data_list_register_values (const char *command, const char *const *argv, format = (int) argv[oind][0]; - frame = get_selected_frame (NULL); + frame = get_selected_frame (); gdbarch = get_frame_arch (frame); numregs = gdbarch_num_cooked_regs (gdbarch); @@ -2388,7 +2388,7 @@ mi_cmd_trace_find (const char *command, const char *const *argv, int argc) error (_("Invalid mode '%s'"), mode); if (has_stack_frames () || get_traceframe_number () >= 0) - print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1); + print_stack_frame (get_selected_frame (), 1, LOC_AND_ADDRESS, 1); } void @@ -2630,7 +2630,7 @@ mi_cmd_trace_frame_collected (const char *command, const char *const *argv, ui_out_emit_list list_emitter (uiout, "registers"); - frame = get_selected_frame (NULL); + frame = get_selected_frame (); gdbarch = get_frame_arch (frame); numregs = gdbarch_num_cooked_regs (gdbarch); diff --git a/gdb/namespace.c b/gdb/namespace.c index 5b5749369ee..e67ddc5efa7 100644 --- a/gdb/namespace.c +++ b/gdb/namespace.c @@ -111,7 +111,7 @@ using_direct::valid_line (unsigned int boundary) const { try { - CORE_ADDR curr_pc = get_frame_pc (get_selected_frame (nullptr)); + CORE_ADDR curr_pc = get_frame_pc (get_selected_frame ()); symtab_and_line curr_sal = find_sal_for_pc (curr_pc, 0); return (decl_line <= curr_sal.line) || (decl_line >= boundary); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index ae498395436..0485670c4b2 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -750,7 +750,7 @@ pc_prefix (CORE_ADDR addr) frame_info_ptr frame; std::optional pc; - frame = get_selected_frame (NULL); + frame = get_selected_frame (); if ((pc = get_frame_pc_if_available (frame)) && *pc == addr) return "=> "; } diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index b4f1dcc3dea..4bd755b24f2 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -2799,7 +2799,7 @@ record_btrace_set_replay (struct thread_info *tp, record_btrace_clear_histories (btinfo); tp->set_stop_pc (regcache_read_pc (get_thread_regcache (tp))); - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC, 1); } /* The goto_record_begin method of target record-btrace. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index 69d2c100e57..bd3ea7ef962 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -2025,7 +2025,7 @@ record_full_goto_entry (struct record_full_entry *p) thread_info *thr = inferior_thread (); thr->set_stop_pc (regcache_read_pc (get_thread_regcache (thr))); - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC, 1); } /* The "goto_record_begin" target method. */ @@ -2509,7 +2509,7 @@ record_full_restore (struct bfd &cbfd) gdb_printf (_("Restored records from core file %s.\n"), bfd_get_filename (&cbfd)); - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC, 1); } /* bfdcore_write -- write bytes into a core file section. */ diff --git a/gdb/stack.c b/gdb/stack.c index 7329430adab..e084976eabf 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2471,7 +2471,7 @@ get_selected_block (CORE_ADDR *addr_in_block) if (!has_stack_frames ()) return 0; - return get_frame_block (get_selected_frame (NULL), addr_in_block); + return get_frame_block (get_selected_frame (), addr_in_block); } /* Find a frame a certain number of levels away from FRAME. @@ -2702,7 +2702,7 @@ return_command (const char *retval_exp, int from_tty) } /* Discard the selected frame and all frames inner-to it. */ - frame_pop (get_selected_frame (NULL)); + frame_pop (get_selected_frame ()); /* Store RETURN_VALUE in the just-returned register set. */ if (return_value != NULL) @@ -2726,7 +2726,7 @@ return_command (const char *retval_exp, int from_tty) select_frame (get_current_frame ()); /* If interactive, print the frame that is now current. */ if (from_tty) - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1); + print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC, 1); } /* Find the most inner frame in the current stack for a function called diff --git a/gdb/thread.c b/gdb/thread.c index 110e58a70aa..96c733e0629 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1243,7 +1243,7 @@ do_print_thread (ui_out *uiout, const char *requested_threads, { /* The switch above put us at the top of the stack (leaf frame). */ - print_stack_frame (get_selected_frame (NULL), + print_stack_frame (get_selected_frame (), /* For MI output, print frame level. */ uiout->is_mi_like_p (), LOCATION, 0); @@ -2163,7 +2163,7 @@ print_selected_thread_frame (struct ui_out *uiout, uiout->text ("\n"); if (has_stack_frames ()) - print_stack_frame_to_uiout (uiout, get_selected_frame (NULL), + print_stack_frame_to_uiout (uiout, get_selected_frame (), 1, SRC_AND_LOC, 1); } } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 7f078684b14..798bb9a552d 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2188,7 +2188,7 @@ tfind_1 (enum trace_find_type type, int num, else print_what = SRC_AND_LOC; - print_stack_frame (get_selected_frame (NULL), 1, print_what, 1); + print_stack_frame (get_selected_frame (), 1, print_what, 1); do_displays (); } } diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 17ae8e7a590..f3d3cbe87a6 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -59,7 +59,7 @@ tui_register_changed (const frame_info_ptr &frame, int regno) And even if the frames differ a register change made in one can still show up in the other. So we always use the selected frame here, and ignore FRAME. */ - fi = get_selected_frame (NULL); + fi = get_selected_frame (); tui_data_win ()->check_register_values (fi); } @@ -114,7 +114,7 @@ tui_refresh_frame_and_register_information () frame_info_ptr fi; if (has_stack_frames ()) { - fi = get_selected_frame (NULL); + fi = get_selected_frame (); /* Display the frame position (even if there is no symbols or the PC is not known). */ diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 28f0d8b82d4..3e2e0745993 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -143,7 +143,7 @@ tui_data_window::update_register_data (const reggroup *group) if (group == nullptr) group = general_reggroup; - frame_info_ptr frame = get_selected_frame (nullptr); + frame_info_ptr frame = get_selected_frame (); struct gdbarch *gdbarch = get_frame_arch (frame); if (m_current_group == group && m_gdbarch == gdbarch) diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 85b754730c8..783d4b2a1c2 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -158,7 +158,7 @@ tui_source_window::do_scroll_vertical (int num_to_scroll) if (cursal.symtab == NULL) { - frame_info_ptr fi = get_selected_frame (NULL); + frame_info_ptr fi = get_selected_frame (); s = find_symtab_for_pc (get_frame_pc (fi)); arch = get_frame_arch (fi); } diff --git a/gdb/varobj.c b/gdb/varobj.c index edd94ea4963..0cd3ba90a91 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -276,7 +276,7 @@ varobj_create (const char *objname, { /* Allow creator to specify context of variable. */ if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME)) - fi = get_selected_frame (NULL); + fi = get_selected_frame (); else /* FIXME: cagney/2002-11-23: This code should be doing a lookup using the frame ID and not just the frame's @@ -354,7 +354,7 @@ varobj_create (const char *objname, var->root->frame = get_frame_id (fi); var->root->thread_id = inferior_thread ()->global_num; - old_id = get_frame_id (get_selected_frame (NULL)); + old_id = get_frame_id (get_selected_frame ()); select_frame (fi); } base-commit: dafd73bcda60e9a54bdd43c79337dce452b1d8af -- 2.51.0