This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb/2188: gdb 6.5 -- internal error with "-var-update *" command


The following reply was made to PR gdb/2188; it has been noted by GNATS.

From: Greg Watson <g.watson@computer.org>
To: gdb-gnats@sources.redhat.com
Cc:  
Subject: Re: gdb/2188: gdb 6.5 -- internal error with "-var-update *" command
Date: Sun, 10 Dec 2006 13:16:56 -0700

 I just verified the same issue on FC5. Stack trace is below. I have a  
 core file if you're interested.
 
 #0  0x007e2402 in __kernel_vsyscall ()
 #1  0x00ad0159 in raise () from /lib/libc.so.6
 #2  0x00ad16e3 in abort () from /lib/libc.so.6
 #3  0x08087918 in internal_vproblem (problem=0x82b58a0,
      file=0x8282ac5 "varobj.c", line=Variable "line" is not available.
 ) at utils.c:796
 #4  0x08084cd3 in internal_verror (file=0x8282ac5 "varobj.c", line=1471,
      fmt=0x8239592 "%s: Assertion `%s' failed.",
      ap=0xbfc24fac ",+(\b<EF><BF><BD>* 
 (\bXP<C2><BF><EF><BF><BD>O<C2><BF>(P<C2>
 <BF>\2300\226\b8\222<EF><BF><BD>\b<EF><BF><BD>O<C2><BF><C6><AA>\027\b8 
 \222<EF>
 <BF><BD>\bhP<C2><BF>8P<C2><BF>}<EF><BF><BD>\027 
 \bXP<C2><BF>P<EF><BF><BD>m\b\030P
 <C2><BF>\023<EF><BF><BD>\v\b<EF><BF><BD>o<EF><BF><BD>") at utils.c:811
 #5  0x08084d09 in internal_error (file=Could not find the frame base  
 for "intern
 al_error".
 ) at utils.c:820
 #6  0x0817ad34 in my_value_equal (val1=0x8963098, val2=0x8cf9238,
      error2=0xbfc25028) at varobj.c:1471
 #7  0x0817c67d in varobj_update (varp=0xbfc25058, changelist=0xbfc25068)
      at varobj.c:945
 #8  0x080be650 in varobj_update_one (var=0x870fea8,
      print_values=PRINT_NO_VALUES) at .././gdb/mi/mi-cmd-var.c:541
 #9  0x080bea07 in mi_cmd_var_update (command=0x8710338 "var-update",
      argv=0x86f2938, argc=1) at .././gdb/mi/mi-cmd-var.c:506
 #10 0x080c1bb5 in captured_mi_execute_command (uiout=0x86e6e00,
      data=0xbfc25148) at .././gdb/mi/mi-main.c:1242
 #11 0x0811c4c2 in catch_exception (uiout=0x86e6e00,
      func=0x80c17e0 <captured_mi_execute_command>,  
 func_args=0xbfc25148, mask=6)
      at exceptions.c:469
 #12 0x080c16de in mi_execute_command (cmd=0x8ca1050 "-var-update *",
      from_tty=1) at .././gdb/mi/mi-main.c:1171
 #13 0x080c0cb6 in mi_execute_command_wrapper (cmd=0x8ca1050 "-var- 
 update *")
      at .././gdb/mi/mi-interp.c:302
 #14 0x0811f850 in handle_file_event (event_file_desc=0) at event- 
 loop.c:730
 #15 0x0811ecf9 in process_event () at event-loop.c:343
 #16 0x0811f4c5 in gdb_do_one_event (data=0x0) at event-loop.c:380
 #17 0x0811c2a3 in catch_errors (func=0x811f3b0 <gdb_do_one_event>,
      func_args=0x0, errstring=0x8240d6e "", mask=6) at exceptions.c:515
 #18 0x0811f37a in start_event_loop () at event-loop.c:406
 #19 0x0807d22b in captured_command_loop (data=0x0) at .././gdb/main.c: 
 101
 #20 0x0811c2a3 in catch_errors (func=0x807d220 <captured_command_loop>,
      func_args=0x0, errstring=0x8240d6e "", mask=6) at exceptions.c:515
 #21 0x0807da44 in captured_main (data=0xbfc253f4) at .././gdb/main.c:834
 #22 0x0811c2a3 in catch_errors (func=0x807d260 <captured_main>,
      func_args=0xbfc253f4, errstring=0x8240d6e "", mask=6) at  
 exceptions.c:515
 #23 0x0807d211 in gdb_main (args=0xbfc253f4) at .././gdb/main.c:843
 #24 0x0807d1d5 in main (argc=Cannot access memory at address 0x2a38
 ) at gdb.c:35
 
 Here's how to repeat:
 
 1. Download OpenMPI 1.2b1 from http://www.open-mpi.org/software/ompi/ 
 v1.2/
 
 2. Configure with:
 
 ./configure --with-devel-headers
 
 3. Build and install.
 
 4. Download gdb-6.5, configure, build and install.
 
 5. Create the following test app.
 
 #include <stdio.h>
 #include <mpi.h>
 
 int main(int argc, char *argv[])
 {
          int rank;
 
          MPI_Init(&argc, &argv);
          MPI_Comm_rank(MPI_COMM_WORLD, &rank);
          printf("hello world from %d\n", rank);
          MPI_Finalize();
 	return 0;
 }
 
 6. Build the test app with the command:
 
 mpicc -g -o mpitest mpitest.c
 
 7. Follow the procedure in the bug report.
 
 Note that this bug does not present if the program doesn't call  
 MPI_Init(). I think this problem occurs because MPI_Init() corrupts  
 the address of argc, which is being monitored by the -var-update  
 command. Here's what I see in gdb without MI enabled:
 
 Starting program: /home/greg/mpitest
 [Thread debugging using libthread_db enabled]
 [New Thread -1208867152 (LWP 11047)]
 [Switching to Thread -1208867152 (LWP 11047)]
 
 Breakpoint 1, main (argc=1, argv=0xbfe32e54) at mpitest.c:9
 9               MPI_Init(&argc, &argv);
 (gdb) p argc
 $1 = 1
 (gdb) n
 10              MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 (gdb) p argc
 Cannot access memory at address 0x0
 (gdb)
 
 It's obviously not correct for OpenMPI to corrupt argc, but also I  
 don't think it's correct that it should cause gdb to crash. I guess  
 there needs to be a check somewhere to make sure the MI variable is  
 not pointing to a bad address?
 
 Regards,
 
 Greg


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]