Репозитории ALT
S: | 13.2.0.43.854f46b6377-alt2 |
5.1: | 6.6-alt3 |
4.1: | 6.6-alt3 |
4.0: | 6.6-alt2 |
3.0: | 6.3-alt2 |
Группа :: Разработка/Отладчики
Пакет: gdb
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: 10.selected-frame.patch
Скачать
Скачать
2004-10-11
This patch is not submitted. Many of these functions should be passing
a frame around rather than calling get_selected_frame, but at least it
is an improvement over deprecated_selected_frame.
2005-11-20
Patch updated, but still not submitted.
---
gdb/breakpoint.c | 6 +++---
gdb/cli/cli-cmds.c | 5 +----
gdb/f-valprint.c | 18 ++++++------------
gdb/infcmd.c | 27 ++++++++++-----------------
gdb/inflow.c | 2 +-
gdb/infrun.c | 2 +-
gdb/stack.c | 4 ++--
gdb/testsuite/gdb.base/default.exp | 16 ++++++++--------
gdb/tui/tui-disasm.c | 2 +-
gdb/tui/tui-source.c | 2 +-
gdb/tui/tui-winsource.c | 2 +-
gdb/valops.c | 16 +++++++++-------
gdb/varobj.c | 2 +-
13 files changed, 45 insertions(+), 59 deletions(-)
Index: gdb-6.6.dfsg/gdb/breakpoint.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/breakpoint.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/breakpoint.c 2007-01-27 20:35:28.000000000 -0500
@@ -928,7 +928,7 @@ insert_bp_location (struct bp_location *
/* FIXME drow/2003-09-09: It would be nice if evaluate_expression
took a frame parameter, so that we didn't have to change the
selected frame. */
- saved_frame_id = get_frame_id (deprecated_selected_frame);
+ saved_frame_id = get_frame_id (get_selected_frame (NULL));
/* Determine if the watchpoint is within scope. */
if (bpt->owner->exp_valid_block == NULL)
@@ -5934,7 +5934,7 @@ until_break_command (char *arg, int from
{
struct symtabs_and_lines sals;
struct symtab_and_line sal;
- struct frame_info *prev_frame = get_prev_frame (deprecated_selected_frame);
+ struct frame_info *prev_frame = get_prev_frame (get_selected_frame (NULL));
struct breakpoint *breakpoint;
struct cleanup *old_chain;
struct continuation_arg *arg1;
@@ -5971,7 +5971,7 @@ until_break_command (char *arg, int from
/* Otherwise, specify the current frame, because we want to stop only
at the very same frame. */
breakpoint = set_momentary_breakpoint (sal,
- get_frame_id (deprecated_selected_frame),
+ get_frame_id (get_selected_frame (NULL)),
bp_until);
if (!target_can_async_p ())
Index: gdb-6.6.dfsg/gdb/cli/cli-cmds.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/cli/cli-cmds.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/cli/cli-cmds.c 2007-01-27 20:35:28.000000000 -0500
@@ -915,10 +915,7 @@ disassemble_command (char *arg, int from
name = NULL;
if (!arg)
{
- if (!deprecated_selected_frame)
- error (_("No frame selected."));
-
- pc = get_frame_pc (deprecated_selected_frame);
+ pc = get_frame_pc (get_selected_frame (_("No frame selected.")));
if (find_pc_partial_function (pc, &name, &low, &high) == 0)
error (_("No function contains program counter for selected frame."));
#if defined(TUI)
Index: gdb-6.6.dfsg/gdb/f-valprint.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/f-valprint.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/f-valprint.c 2007-01-27 20:35:28.000000000 -0500
@@ -71,7 +71,7 @@ f77_get_dynamic_lowerbound (struct type
switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type))
{
case BOUND_BY_VALUE_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ current_frame_addr = get_frame_base (get_selected_frame (NULL));
if (current_frame_addr > 0)
{
*lower_bound =
@@ -95,7 +95,7 @@ f77_get_dynamic_lowerbound (struct type
break;
case BOUND_BY_REF_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ current_frame_addr = get_frame_base (get_selected_frame (NULL));
if (current_frame_addr > 0)
{
ptr_to_lower_bound =
@@ -129,7 +129,7 @@ f77_get_dynamic_upperbound (struct type
switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type))
{
case BOUND_BY_VALUE_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ current_frame_addr = get_frame_base (get_selected_frame (NULL));
if (current_frame_addr > 0)
{
*upper_bound =
@@ -158,7 +158,7 @@ f77_get_dynamic_upperbound (struct type
break;
case BOUND_BY_REF_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ current_frame_addr = get_frame_base (get_selected_frame (NULL));
if (current_frame_addr > 0)
{
ptr_to_upper_bound =
@@ -643,10 +643,7 @@ info_common_command (char *comname, int
first make sure that it is visible and if so, let
us display its contents */
- fi = deprecated_selected_frame;
-
- if (fi == NULL)
- error (_("No frame selected"));
+ fi = get_selected_frame (_("No frame selected"));
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
@@ -735,10 +732,7 @@ there_is_a_visible_common_named (char *c
if (comname == NULL)
error (_("Cannot deal with NULL common name!"));
- fi = deprecated_selected_frame;
-
- if (fi == NULL)
- error (_("No frame selected"));
+ fi = get_selected_frame (_("No frame selected"));
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
Index: gdb-6.6.dfsg/gdb/infcmd.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/infcmd.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/infcmd.c 2007-01-27 20:35:28.000000000 -0500
@@ -1288,10 +1288,8 @@ finish_command (char *arg, int from_tty)
error (_("The \"finish\" command does not take any arguments."));
if (!target_has_execution)
error (_("The program is not running."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
- frame = get_prev_frame (deprecated_selected_frame);
+ frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
if (frame == 0)
error (_("\"finish\" not meaningful in the outermost frame."));
@@ -1309,7 +1307,7 @@ finish_command (char *arg, int from_tty)
/* Find the function we will return from. */
- function = find_pc_function (get_frame_pc (deprecated_selected_frame));
+ function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
/* Print info on the selected frame, including level number but not
source. */
@@ -1675,13 +1673,12 @@ registers_info (char *addr_exp, int fpre
if (!target_has_registers)
error (_("The program has no registers now."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
if (!addr_exp)
{
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, -1, fpregs);
+ get_selected_frame (_("No selected frame.")),
+ -1, fpregs);
return;
}
@@ -1714,12 +1711,12 @@ registers_info (char *addr_exp, int fpre
/* A register name? */
{
- int regnum = frame_map_name_to_regnum (deprecated_selected_frame,
+ int regnum = frame_map_name_to_regnum (get_selected_frame (_("No selected frame.")),
start, end - start);
if (regnum >= 0)
{
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, regnum, fpregs);
+ get_selected_frame (NULL), regnum, fpregs);
continue;
}
}
@@ -1733,7 +1730,7 @@ registers_info (char *addr_exp, int fpre
&& regnum < NUM_REGS + NUM_PSEUDO_REGS)
{
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, regnum, fpregs);
+ get_selected_frame (NULL), regnum, fpregs);
continue;
}
}
@@ -1759,7 +1756,7 @@ registers_info (char *addr_exp, int fpre
if (gdbarch_register_reggroup_p (current_gdbarch, regnum,
group))
gdbarch_print_registers_info (current_gdbarch,
- gdb_stdout, deprecated_selected_frame,
+ gdb_stdout, get_selected_frame (NULL),
regnum, fpregs);
}
continue;
@@ -1789,8 +1786,6 @@ print_vector_info (struct gdbarch *gdbar
{
if (!target_has_registers)
error (_("The program has no registers now."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
if (gdbarch_print_vector_info_p (gdbarch))
gdbarch_print_vector_info (gdbarch, file, frame, args);
@@ -1815,7 +1810,7 @@ print_vector_info (struct gdbarch *gdbar
static void
vector_info (char *args, int from_tty)
{
- print_vector_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args);
+ print_vector_info (current_gdbarch, gdb_stdout, get_selected_frame (NULL), args);
}
@@ -2007,8 +2002,6 @@ print_float_info (struct gdbarch *gdbarc
{
if (!target_has_registers)
error (_("The program has no registers now."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
if (gdbarch_print_float_info_p (gdbarch))
gdbarch_print_float_info (gdbarch, file, frame, args);
@@ -2035,7 +2028,7 @@ static void
float_info (char *args, int from_tty)
{
print_float_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, args);
+ get_selected_frame (NULL), args);
}
static void
Index: gdb-6.6.dfsg/gdb/inflow.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/inflow.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/inflow.c 2007-01-27 20:35:28.000000000 -0500
@@ -588,7 +588,7 @@ kill_command (char *arg, int from_tty)
if (target_has_stack)
{
printf_filtered (_("In %s,\n"), target_longname);
- if (deprecated_selected_frame == NULL)
+ if (deprecated_safe_get_selected_frame () == NULL)
fputs_filtered ("No selected stack frame.\n", gdb_stdout);
else
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
Index: gdb-6.6.dfsg/gdb/infrun.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/infrun.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/infrun.c 2007-01-27 20:35:28.000000000 -0500
@@ -3652,7 +3652,7 @@ save_inferior_status (int restore_stack_
inf_status->registers = regcache_dup (current_regcache);
- inf_status->selected_frame_id = get_frame_id (deprecated_selected_frame);
+ inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
return inf_status;
}
Index: gdb-6.6.dfsg/gdb/stack.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/stack.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/stack.c 2007-01-27 20:35:28.000000000 -0500
@@ -1933,7 +1933,7 @@ func_command (char *arg, int from_tty)
if (!found)
printf_filtered (_("'%s' not within current stack frame.\n"), arg);
- else if (frame != deprecated_selected_frame)
+ else if (frame != get_selected_frame (NULL))
select_and_print_frame (frame);
}
@@ -1942,7 +1942,7 @@ func_command (char *arg, int from_tty)
enum language
get_frame_language (void)
{
- struct frame_info *frame = deprecated_selected_frame;
+ struct frame_info *frame = deprecated_safe_get_selected_frame ();
if (frame)
{
Index: gdb-6.6.dfsg/gdb/tui/tui-disasm.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/tui/tui-disasm.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/tui/tui-disasm.c 2007-01-27 20:35:28.000000000 -0500
@@ -386,7 +386,7 @@ tui_vertical_disassem_scroll (enum tui_s
content = (tui_win_content) TUI_DISASM_WIN->generic.content;
if (cursal.symtab == (struct symtab *) NULL)
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
Index: gdb-6.6.dfsg/gdb/tui/tui-source.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/tui/tui-source.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/tui/tui-source.c 2007-01-27 20:35:28.000000000 -0500
@@ -338,7 +338,7 @@ tui_vertical_source_scroll (enum tui_scr
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab == (struct symtab *) NULL)
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
Index: gdb-6.6.dfsg/gdb/tui/tui-winsource.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/tui/tui-winsource.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/tui/tui-winsource.c 2007-01-27 20:35:28.000000000 -0500
@@ -314,7 +314,7 @@ tui_horizontal_source_scroll (struct tui
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab == (struct symtab *) NULL)
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
Index: gdb-6.6.dfsg/gdb/valops.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/valops.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/valops.c 2007-01-27 20:35:28.000000000 -0500
@@ -570,7 +570,7 @@ value_assign (struct value *toval, struc
/* Since modifying a register can trash the frame chain, and modifying memory
can trash the frame cache, we save the old frame and then restore the new
frame afterwards. */
- old_frame = get_frame_id (deprecated_selected_frame);
+ old_frame = get_frame_id (deprecated_safe_get_selected_frame ());
switch (VALUE_LVAL (toval))
{
@@ -2652,16 +2652,18 @@ value_of_local (const char *name, int co
struct symbol *func, *sym;
struct block *b;
struct value * ret;
+ struct frame_info *frame;
- if (deprecated_selected_frame == 0)
+ if (complain)
+ frame = get_selected_frame (_("no frame selected"));
+ else
{
- if (complain)
- error (_("no frame selected"));
- else
+ frame = deprecated_safe_get_selected_frame ();
+ if (frame == 0)
return 0;
}
- func = get_frame_function (deprecated_selected_frame);
+ func = get_frame_function (frame);
if (!func)
{
if (complain)
@@ -2690,7 +2692,7 @@ value_of_local (const char *name, int co
return NULL;
}
- ret = read_var_value (sym, deprecated_selected_frame);
+ ret = read_var_value (sym, frame);
if (ret == 0 && complain)
error (_("`%s' argument unreadable"), name);
return ret;
Index: gdb-6.6.dfsg/gdb/varobj.c
===================================================================
--- gdb-6.6.dfsg.orig/gdb/varobj.c 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/varobj.c 2007-01-27 20:35:28.000000000 -0500
@@ -498,7 +498,7 @@ varobj_create (char *objname,
if (fi != NULL)
{
var->root->frame = get_frame_id (fi);
- old_fi = deprecated_selected_frame;
+ old_fi = get_selected_frame (NULL);
select_frame (fi);
}
Index: gdb-6.6.dfsg/gdb/testsuite/gdb.base/default.exp
===================================================================
--- gdb-6.6.dfsg.orig/gdb/testsuite/gdb.base/default.exp 2007-01-27 20:35:20.000000000 -0500
+++ gdb-6.6.dfsg/gdb/testsuite/gdb.base/default.exp 2007-01-27 20:35:28.000000000 -0500
@@ -167,7 +167,7 @@ gdb_test "disable breakpoints" "" "disab
#test disable display
gdb_test "disable display" "" "disable display"
#test disassemble
-gdb_test "disassemble" "No frame selected." "disassemble"
+gdb_test "disassemble" "No (frame selected|registers)." "disassemble"
#test display
gdb_test "display" "" "display"
#test do
@@ -229,9 +229,9 @@ gdb_expect {
}
#test frame "f" abbreviation
-gdb_test "f" "No stack." "frame \"f\" abbreviation"
+gdb_test "f" "No (stack|registers)." "frame \"f\" abbreviation"
#test frame
-gdb_test "frame" "No stack." "frame"
+gdb_test "frame" "No (stack|registers)." "frame"
#test fg
gdb_test "fg" "The program is not being run." "fg"
# FIXME: fg kills the udi connection
@@ -294,9 +294,9 @@ gdb_test "ignore" "Argument required .a
#test info address
gdb_test "info address" "Argument required." "info address"
#test info all-registers
-gdb_test "info all-registers" "The program has no registers now." "info all-registers"
+gdb_test "info all-registers" "(The program has no registers now|No registers)." "info all-registers"
#test info args
-gdb_test "info args" "No frame selected." "info args"
+gdb_test "info args" "No (frame selected|registers)." "info args"
#test info bogus-gdb-command
gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\". Try \"help info\".*" "info bogus-gdb-command"
#test info breakpoints
@@ -320,11 +320,11 @@ gdb_test "info frame" "No stack.|No sele
#test info files
gdb_test "info files" "" "info files"
#test info float
-gdb_test "info float" "The program has no registers now." "info float"
+gdb_test "info float" "(The program has no registers now|No registers)." "info float"
#test info functions
gdb_test "info functions" "All defined functions:" "info functions"
#test info locals
-gdb_test "info locals" "No frame selected." "info locals"
+gdb_test "info locals" "(No frame selected|No registers)." "info locals"
#test info program
gdb_test "info program" "The program being debugged is not being run." "info program"
#test info registers
@@ -352,7 +352,7 @@ gdb_test "info types" "All defined types
#test info variables
gdb_test "info variables" "All defined variables:" "info variables"
#test info vector
-gdb_test "info vector" "The program has no registers now." "info vector"
+gdb_test "info vector" "(The program has no registers now|No registers)." "info vector"
#test info warranty
gdb_test "info warranty" "NO WARRANTY(\[^\r\n\]*\[\r\n\])+ *11. *BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY(\[^\r\n\]*\[\r\n\])+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN(\[^\r\n\]*\[\r\n\])+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES(\[^\r\n\]*\[\r\n\])+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED(\[^\r\n\]*\[\r\n\])+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF(\[^\r\n\]*\[\r\n\])+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS(\[^\r\n\]*\[\r\n\])+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE(\[^\r\n\]*\[\r\n\])+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,(\[^\r\n\]*\[\r\n\])+REPAIR OR CORRECTION.(\[^\r\n\]*\[\r\n\])+ *12. *IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING(\[^\r\n\]*\[\r\n\])+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR(\[^\r\n\]*\[\r\n\])+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,(\[^\r\n\]*\[\r\n\])+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING(\[^\r\n\]*\[\r\n\])+OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED(\[^\r\n\]*\[\r\n\])+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY(\[^\r\n\]*\[\r\n\])+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER(\[^\r\n\]*\[\r\n\])+PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE(\[^\r\n\]*\[\r\n\])+POSSIBILITY OF SUCH DAMAGES.*" "info warranty"
#test info watchpoints