Bugzilla – Bug 324233
[patch] repeated "list" commands don't match gdb
Last modified: 2007-10-08 12:30:59 UTC
---- Reported by joeshaw@novell.com 2007-05-07 16:37:43 MST ---- mdb's list command seems to take gdb syntax, but doesn't match gdb's behavior in many cases, particularly in keeping a cursor when running "list" or "list -" repeatedly: For example: (mdb) list 478 479 if (! ExtendedAttribute.Supported) { 480 Logger.Log.Warn ("Extended attributes are not supported on this filesystem. " + 481 "Performance will suffer as a result."); 482 } 483 484 if (disable_textcache) { 485 Log.Warn ("Running with text-cache disabled!"); 486 Log.Warn ("*** Snippets will not be returned for documents indexed in this session."); 487 } 488 489 // Start our memory-logging thread 490 if (arg_debug_memory) 491 ExceptionHandlingThread.Start (new ThreadStart (LogMemoryUsage)); 492 493 // Do BEAGLE_EXERCISE_THE_DOG_HARDER-related processing. 494 ExerciseTheDogHarder (); 495 496 // Initialize GObject type system 497 g_type_init (); (mdb) list 478 479 if (! ExtendedAttribute.Supported) { 480 Logger.Log.Warn ("Extended attributes are not supported on this filesystem. " + 481 "Performance will suffer as a result."); 482 } 483 484 if (disable_textcache) { 485 Log.Warn ("Running with text-cache disabled!"); 486 Log.Warn ("*** Snippets will not be returned for documents indexed in this session."); 487 } 488 489 // Start our memory-logging thread 490 if (arg_debug_memory) 491 ExceptionHandlingThread.Start (new ThreadStart (LogMemoryUsage)); 492 493 // Do BEAGLE_EXERCISE_THE_DOG_HARDER-related processing. 494 ExerciseTheDogHarder (); 495 496 // Initialize GObject type system 497 g_type_init (); (mdb) However, the cursor is correctly moved if you run "list" and then simply hit enter: (mdb) list 478 479 if (! ExtendedAttribute.Supported) { 480 Logger.Log.Warn ("Extended attributes are not supported on this filesystem. " + 481 "Performance will suffer as a result."); 482 } 483 484 if (disable_textcache) { 485 Log.Warn ("Running with text-cache disabled!"); 486 Log.Warn ("*** Snippets will not be returned for documents indexed in this session."); 487 } 488 489 // Start our memory-logging thread 490 if (arg_debug_memory) 491 ExceptionHandlingThread.Start (new ThreadStart (LogMemoryUsage)); 492 493 // Do BEAGLE_EXERCISE_THE_DOG_HARDER-related processing. 494 ExerciseTheDogHarder (); 495 496 // Initialize GObject type system 497 g_type_init (); (mdb) 498 499 if (SystemInformation.XssInit ()) 500 Logger.Log.Debug ("Established a connection to the X server"); 501 else 502 Logger.Log.Debug ("Unable to establish a connection to the X server"); 503 XSetIOErrorHandler (BeagleXIOErrorHandler); 504 505 // Lower our CPU priority 506 SystemPriorities.Renice (7); 507 508 QueryDriver.Init (); 509 Server.Init (); 510 511 SetupSignalHandlers (); 512 Shutdown.ShutdownEvent += OnShutdown; 513 514 main_loop = new MainLoop (); 515 Shutdown.RegisterMainLoop (main_loop); 516 517 // Defer all actual startup until the main loop is (mdb) The same behavior occurs with "list -" to go backward. ---- Additional Comments From martin@ximian.com 2007-05-09 10:42:00 MST ---- If you type `list' a second time, it's a new command and thus it starts again. ---- Additional Comments From joeshaw@novell.com 2007-05-09 11:45:26 MST ---- This doesn't match gdb behavior, and since mdb otherwise "feels" a lot like gdb, I think this is a bug: (gdb) list 2 #include <sys/types.h> 3 4 int 5 main (int argc, char *argv[]) 6 { 7 printf ("hello world\n"); 8 printf ("UID: %d\n", getuid ()); 9 printf ("Effective UID: %d\n", geteuid ()); 10 11 return 0; (gdb) list 12 } (gdb) (gdb) list - 2 #include <sys/types.h> 3 4 int 5 main (int argc, char *argv[]) 6 { 7 printf ("hello world\n"); 8 printf ("UID: %d\n", getuid ()); 9 printf ("Effective UID: %d\n", geteuid ()); 10 11 return 0; (gdb) list - 1 #include <unistd.h> (gdb) And lastly, the help: List specified function or line. With no argument, lists ten more lines after or around previous listing. "list -" lists the ten lines before a previous ten-line listing. One argument specifies a line, and ten lines are listed around that line. Two arguments with comma between specify starting and ending lines to list. Lines can be specified in these ways: LINENUM, to list around that line in current file, FILE:LINENUM, to list around that line in that file, FUNCTION, to list around beginning of that function, FILE:FUNCTION, to distinguish among like-named static functions. *ADDRESS, to list around the line containing that address. With two args if one is empty it stands for ten lines away from the other arg. ---- Additional Comments From joeshaw@novell.com 2007-05-09 11:50:28 MST ---- BTW, I would suggest matching the gdb behavior and adding a new way of listing from the current running position, like "list ." (The lack of a way to do this in gdb short of jumping up a stack frame and back down has always annoyed me.) ---- Additional Comments From joeshaw@novell.com 2007-05-10 12:57:06 MST ---- I'm reopening this as a wishlist bug and attaching a patch which implements it. It keeps the source code state between "list" invocations and resets it if you run "list ." ---- Additional Comments From joeshaw@novell.com 2007-05-10 12:57:34 MST ---- Created an attachment (id=171926) Patch to implement this behavior Imported an attachment (id=171926) Unknown operating system unknown. Setting to default OS "Other".
.