From 5a0031e463c8b9c41c55488ed609e73c775034d8 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Sun, 3 Nov 2002 22:09:39 +0000 Subject: [PATCH] merge from mainline --- gdb/testsuite/gdb.asm/asm-source.exp | 9 ++++++--- gdb/testsuite/gdb.asm/asmsrc1.s | 16 ++++++++++------ gdb/testsuite/gdb.asm/asmsrc2.s | 3 ++- gdb/testsuite/gdb.asm/common.inc | 14 +++++++++++--- gdb/testsuite/gdb.base/constvars.c | 5 +++++ gdb/testsuite/gdb.base/constvars.exp | 5 +++++ gdb/testsuite/gdb.base/default.exp | 4 ++-- gdb/testsuite/gdb.base/help.exp | 8 ++++---- gdb/testsuite/gdb.threads/schedlock.c | 2 +- gdb/tui/ChangeLog | 22 ++++++++++++++++++++++ gdb/tui/tui-hooks.c | 1 - gdb/tui/tuiIO.c | 15 ++++++++++++--- gdb/tui/tuiWin.c | 19 +++++++++++++++++++ 13 files changed, 99 insertions(+), 24 deletions(-) diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index f10f4ae2a62..deb4b5f9559 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -57,6 +57,9 @@ if [istarget "i\[3456\]86-*-*"] then { if [istarget "m32r*-*"] then { set asm-arch m32r } +if [istarget "mips*-*"] then { + set asm-arch mips +} if [istarget "powerpc*-*"] then { set asm-arch powerpc } @@ -194,7 +197,7 @@ gdb_test "list $entry_symbol" ".*gdbasm_startup.*" "list" # Now try a source file search gdb_test "search A routine for foo2 to call" \ - "39\[ \t\]+comment \"A routine for foo2 to call.\"" "search" + "40\[ \t\]+comment \"A routine for foo2 to call.\"" "search" # See if `f' prints the right source file. gdb_test "f" ".*asmsrc2\[.\]s:8.*" "f in foo2" @@ -219,7 +222,7 @@ gdb_test "s" "" "s 2" gdb_test "n" "" "n 2" # Now see if a capped `bt' is correct. -gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:44.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:33.*" "bt 3 in foo3" +gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:45.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:33.*" "bt 3 in foo3" # Try 'info source' from asmsrc1.s gdb_test "info source" \ @@ -277,7 +280,7 @@ gdb_test "next" "17\[ \t\]+gdbasm_leave" "next over foo3" # Try 'return' from foo2 gdb_test "return" "\#0 main .*37\[ \t\]+gdbasm_exit0" "return from foo2" \ - "Make selected stack frame return now\?.*" "y" + "Make (foo2|selected stack frame) return now\?.*" "y" # See if we can look at a global variable gdb_test "print globalvar" ".* = 11" "look at global variable" diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s index f14cd915921..cba0e90ec2a 100644 --- a/gdb/testsuite/gdb.asm/asmsrc1.s +++ b/gdb/testsuite/gdb.asm/asmsrc1.s @@ -10,18 +10,18 @@ comment "This file is not linked with crt0." comment "Provide very simplistic equivalent." .global _start -_start: +gdbasm_declare _start gdbasm_startup gdbasm_call main gdbasm_exit0 - + gdbasm_end _start comment "main routine for assembly source debugging test" comment "This particular testcase uses macros in .inc to achieve" comment "machine independence." .global main -main: +gdbasm_declare main gdbasm_enter comment "Call a macro that consists of several lines of assembler code." @@ -35,23 +35,27 @@ comment "Call a subroutine in another file." comment "All done." gdbasm_exit0 + gdbasm_end main comment "A routine for foo2 to call." .global foo3 -foo3: +gdbasm_declare foo3 gdbasm_enter gdbasm_leave + gdbasm_end foo3 .global exit -exit: +gdbasm_declare exit gdbasm_exit0 + gdbasm_end exit comment "A static function" -foostatic: +gdbasm_declare foostatic gdbasm_enter gdbasm_leave + gdbasm_end foostatic comment "A global variable" diff --git a/gdb/testsuite/gdb.asm/asmsrc2.s b/gdb/testsuite/gdb.asm/asmsrc2.s index 9d7713fad84..4366536acbe 100644 --- a/gdb/testsuite/gdb.asm/asmsrc2.s +++ b/gdb/testsuite/gdb.asm/asmsrc2.s @@ -4,7 +4,7 @@ comment "Second file in assembly source debugging testcase." .global foo2 -foo2: +gdbasm_declare foo2 gdbasm_enter comment "Call someplace else (several times)." @@ -15,3 +15,4 @@ comment "Call someplace else (several times)." comment "All done, return." gdbasm_leave + gdbasm_end foo2 diff --git a/gdb/testsuite/gdb.asm/common.inc b/gdb/testsuite/gdb.asm/common.inc index 51493929765..04f08ff9cce 100644 --- a/gdb/testsuite/gdb.asm/common.inc +++ b/gdb/testsuite/gdb.asm/common.inc @@ -14,6 +14,15 @@ .word \value .endm + comment "Declare a subroutine" + .macro gdbasm_declare name +\name: + .endm + + comment "End a subroutine" + .macro gdbasm_end name + .endm + comment "arch.inc is responsible for defining the following macros:" comment "enter - subroutine prologue" comment "leave - subroutine epilogue" @@ -23,6 +32,5 @@ comment "exit0 - exit (0)" comment "arch.inc may also override the default definitions of:" comment "datavar - define a data variable" - -comment "macros to label a subroutine may also eventually be needed" -comment "i.e. .global foo\nfoo:\n" +comment "declare - declare the start of a subroutine" +comment "end - end a subroutine" diff --git a/gdb/testsuite/gdb.base/constvars.c b/gdb/testsuite/gdb.base/constvars.c index b0ce7529ecb..16025770e35 100644 --- a/gdb/testsuite/gdb.base/constvars.c +++ b/gdb/testsuite/gdb.base/constvars.c @@ -166,6 +166,11 @@ main (void) const volatile char * const volatile vagary = &victor; const volatile unsigned char * const volatile vendor = &vicar; + + /* various structs with const members */ + + struct crass { char * const ptr; } crass; + struct crisp { char * const *ptr; } crisp; /* misc. references */ /* diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp index bb062ef5cb9..897a025af0c 100644 --- a/gdb/testsuite/gdb.base/constvars.exp +++ b/gdb/testsuite/gdb.base/constvars.exp @@ -278,6 +278,11 @@ proc do_constvar_tests {} { gdb_test "print *locust" " = 70" local_compiler_xfail_check gdb_test "ptype locust" "type = double \\* const" + + local_compiler_xfail_check + gdb_test "ptype crass" "type = struct crass \{\[\r\n\]+\[\ \t\]+char \\* const ptr;\[\r\n\]+\}" + local_compiler_xfail_check + gdb_test "ptype crisp" "type = struct crisp \{\[\r\n\]+\[\ \t\]+char \\* const \\*ptr;\[\r\n\]+\}" } do_constvar_tests diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 078e41688ae..3fc6f0d1f5f 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -636,9 +636,9 @@ gdb_test "show print address" "Printing of addresses is on." "show print address #test show print array gdb_test "show print array" "Prettyprinting of arrays is on." "show print array" #test show print asm-demangle -gdb_test "show print asm-demangle" "Demangling of C\[+\]+ names in disassembly listings is on." "show print asm-demangle" +gdb_test "show print asm-demangle" "Demangling of C\[+\]+/ObjC names in disassembly listings is on." "show print asm-demangle" #test show print demangle -gdb_test "show print demangle" "Demangling of encoded C\[+\]+ names when displaying symbols is on." "show print demangle" +gdb_test "show print demangle" "Demangling of encoded C\[+\]+/ObjC names when displaying symbols is on." "show print demangle" #test show print elements gdb_test "show print elements" "Limit on string chars or array elements to print is 200." "show print elements" #test show print object diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp index 4b3d2eebd81..50da6774373 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -390,9 +390,9 @@ gdb_test "help set print address" "Set printing of addresses\." "help set print # test help set print array gdb_test "help set print array" "Set prettyprinting of arrays\." "help set print array" # test help set print asm-demangle -gdb_test "help set print asm-demangle" "Set demangling of C\[+\]+ names in disassembly listings\." "help set print asm-demangle" +gdb_test "help set print asm-demangle" "Set demangling of C\[+\]+/ObjC names in disassembly listings\." "help set print asm-demangle" # test help set print demangle -gdb_test "help set print demangle" "Set demangling of encoded C\[+\]+ names when displaying symbols\." "help set print demangle" +gdb_test "help set print demangle" "Set demangling of encoded C\[+\]+/ObjC names when displaying symbols\." "help set print demangle" # test help set print elements gdb_test "help set print elements" "Set limit on string chars or array elements to print\.\[\r\n\]+\"set print elements 0\" causes there to be no limit\." "help set print elements" # test help set print object @@ -482,9 +482,9 @@ gdb_test "help show print address" "Show printing of addresses\." "help show pri # test help show print array gdb_test "help show print array" "Show prettyprinting of arrays\." "help show print array" # test help show print asm-demangle -gdb_test "help show print asm-demangle" "Show demangling of C\[+\]+ names in disassembly listings\." "help show print asm-demangle" +gdb_test "help show print asm-demangle" "Show demangling of C\[+\]+/ObjC names in disassembly listings\." "help show print asm-demangle" # test help show print demangle -gdb_test "help show print demangle" "Show demangling of encoded C\[+\]+ names when displaying symbols\." "help show print demangle" +gdb_test "help show print demangle" "Show demangling of encoded C\[+\]+/ObjC names when displaying symbols\." "help show print demangle" # test help show print elements gdb_test "help show print elements" "Show limit on string chars or array elements to print\.\[\r\n\]+\"set print elements 0\" causes there to be no limit\." "help show print elements" # test help show print object diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c index df361d0e0a7..033131c2a52 100644 --- a/gdb/testsuite/gdb.threads/schedlock.c +++ b/gdb/testsuite/gdb.threads/schedlock.c @@ -7,7 +7,7 @@ void *thread_function(void *arg); /* Pointer to function executed by each thread #define NUM 5 -int args[NUM+1]; +unsigned int args[NUM+1]; int main() { int res; diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index e2bc95fe455..c0fb2bed878 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,25 @@ +2002-10-26 Stephane Carrez + + * tuiIO.c (tui_prep_terminal): Save the prompt registered in readline. + (tui_redisplay_readline): Use the last saved prompt. + (tui_rl_saved_prompt): New. + +2002-10-25 Stephane Carrez + + Fix PR gdb/787 + * tuiWin.c (ACS_LRCORNER, ACS_LLCORNER, ACS_ULCORNER, ACS_URCORNER, + ACS_HLINE, ACS_VLINE): Define if they don't exist. + +2002-10-25 Stephane Carrez + + Fix PR gdb/478 + * tuiIO.c (tui_initialize_io): Use setvbuf since this is portable. + +2002-10-02 Elena Zannoni + + * tui-hooks.c (selected_frame_level_changed_hook): Use the one + exported from frame.h. + 2002-09-29 Elena Zannoni * tui.c (tui_show_source): Don't access current_source_symtab, use diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 3beca39c782..e1aad9f03b3 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -69,7 +69,6 @@ int tui_target_has_run = 0; static void (* tui_target_new_objfile_chain) (struct objfile*); -extern void (*selected_frame_level_changed_hook) (int); static void tui_event_loop (void); static void tui_command_loop (void); diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c index f70df8f4748..b9b373c6646 100644 --- a/gdb/tui/tuiIO.c +++ b/gdb/tui/tuiIO.c @@ -124,6 +124,10 @@ static FILE *tui_old_rl_outstream; static int tui_readline_pipe[2]; #endif +/* The last gdb prompt that was registered in readline. + This may be the main gdb prompt or a secondary prompt. */ +static char *tui_rl_saved_prompt; + static unsigned int _tuiHandleResizeDuringIO (unsigned int); static void @@ -194,7 +198,7 @@ tui_redisplay_readline (void) if (tui_current_key_mode == tui_single_key_mode) prompt = ""; else - prompt = get_prompt (); + prompt = tui_rl_saved_prompt; c_pos = -1; c_line = -1; @@ -256,10 +260,15 @@ tui_redisplay_readline (void) } /* Readline callback to prepare the terminal. It is called once - each time we enter readline. There is nothing to do in curses mode. */ + each time we enter readline. Terminal is already setup in curses mode. */ static void tui_prep_terminal (void) { + /* Save the prompt registered in readline to correctly display it. + (we can't use gdb_prompt() due to secondary prompts and can't use + rl_prompt because it points to an alloca buffer). */ + xfree (tui_rl_saved_prompt); + tui_rl_saved_prompt = xstrdup (rl_prompt); } /* Readline callback to restore the terminal. It is called once @@ -600,7 +609,7 @@ tui_initialize_io () fprintf_unfiltered (gdb_stderr, "Cannot redirect readline output"); exit (1); } - setlinebuf (tui_rl_outstream); + setvbuf (tui_rl_outstream, (char*) NULL, _IOLBF, 0); #ifdef O_NONBLOCK (void) fcntl (tui_readline_pipe[0], F_SETFL, O_NONBLOCK); diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index 38283b59da1..484c60a6204 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -96,6 +96,25 @@ static void _parseScrollingArgs (char *, TuiWinInfoPtr *, int *); ** PUBLIC FUNCTIONS ***************************************/ +#ifndef ACS_LRCORNER +# define ACS_LRCORNER '+' +#endif +#ifndef ACS_LLCORNER +# define ACS_LLCORNER '+' +#endif +#ifndef ACS_ULCORNER +# define ACS_ULCORNER '+' +#endif +#ifndef ACS_URCORNER +# define ACS_URCORNER '+' +#endif +#ifndef ACS_HLINE +# define ACS_HLINE '-' +#endif +#ifndef ACS_VLINE +# define ACS_VLINE '|' +#endif + /* Possible values for tui-border-kind variable. */ static const char *tui_border_kind_enums[] = { "space", -- 2.47.2