From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Muller To: "Don Beusee" Cc: gdb-patches@sourceware.cygnus.com Subject: Re: small enhancements to gdb here.. Date: Tue, 21 Nov 2000 00:50:00 -0000 Message-id: <4.2.0.58.20001121092327.018aa100@ics.u-strasbg.fr> References: <200011210757.eAL7vJx28709@dbeusee.us.oracle.com> X-SW-Source: 2000-11/msg00278.html At 08:57 21/11/00 , vous avez écrit: >Hi, > >I originally sent this email to gnu-gdb@gnu.org before I saw the >CONTRIBUTE file. I reformatted the diff output to your >specifications. The diff's are based on 5.0 distribution at GNU's ftp site. > >I have patches for 3 small enhancements to improve convenience: > >- allow O/S commands directly from gdb when no match for internal command. >- additional arg syntax in user-defined commands: > $# number of args > $* all args > $N specific arg (where N is a number from 1 to 9). $1 is the > first > arg (same as $arg0). > ${NN} NN can be any number between 1 and MAXUSERARGS (10 currently). > ${ENV} environment variable >- a user command referencing an argument not provided on the command returns > an empty string, not an error. But this conflict with the history $n expansion ! Why not only keep $*, $# ${NN} About ${ENV} why shouldn't we also support things like ${$i}} if $i is a convinience variable then we would be able to write for ($i=0,i<$#,i++) do print arg $i is ${$i}} Otherwise I don't think it is really useful to restrict to environment variables, we could also search for ENV in the program being debugged. So ${I} would give arg number 5 is I is convertable into a int a has the value 5. Anyhow any way to get the Nnth arg where N is a variable would be most welcome. One more question, are there no languages that accept variables beginning with digits ? I hope not, but maybe it is worth to ask ourselves this question ! Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99 >From kevinb@cygnus.com Tue Nov 21 01:26:00 2000 From: Kevin Buettner To: gdb-patches@sourceware.cygnus.com Subject: [PATCH] solib.c: solib_open() fix Date: Tue, 21 Nov 2000 01:26:00 -0000 Message-id: <1001121092552.ZM19630@ocotillo.lan> X-SW-Source: 2000-11/msg00279.html Content-length: 2088 I've committed the following patch. It fixes a crasher on Linux (and probably most other native ports which use solib-svr4.c). * solib.c (solib_open): Handle the case where solib_absolute_prefix is NULL. RCS file: /cvs/src/src/gdb/solib.c,v retrieving revision 1.27 diff -u -p -r1.27 solib.c --- solib.c 2000/11/21 01:09:54 1.27 +++ solib.c 2000/11/21 09:08:20 @@ -100,21 +100,25 @@ solib_open (char *in_pathname, char **fo int found_file = -1; char *temp_pathname = NULL; - if (solib_absolute_prefix != NULL && - ROOTED_P (in_pathname)) + if (ROOTED_P (in_pathname)) { - int prefix_len = strlen (solib_absolute_prefix); + if (solib_absolute_prefix == NULL) + temp_pathname = in_pathname; + else + { + int prefix_len = strlen (solib_absolute_prefix); + + /* Remove trailing slashes from absolute prefix. */ + while (prefix_len > 0 && SLASH_P (solib_absolute_prefix[prefix_len - 1])) + prefix_len--; + + /* Cat the prefixed pathname together. */ + temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1); + strncpy (temp_pathname, solib_absolute_prefix, prefix_len); + temp_pathname[prefix_len] = '\0'; + strcat (temp_pathname, in_pathname); - /* Remove trailing slashes from absolute prefix. */ - while (prefix_len > 0 && SLASH_P (solib_absolute_prefix[prefix_len - 1])) - prefix_len--; - - /* Cat the prefixed pathname together. */ - temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1); - strncpy (temp_pathname, solib_absolute_prefix, prefix_len); - temp_pathname[prefix_len] = '\0'; - strcat (temp_pathname, in_pathname); - + } /* Now see if we can open it. */ found_file = open (temp_pathname, O_RDONLY, 0); } @@ -137,7 +141,7 @@ solib_open (char *in_pathname, char **fo /* Done. If not found, tough luck. Return found_file and (optionally) found_pathname. */ - if (found_pathname != NULL) + if (found_pathname != NULL && temp_pathname != NULL) *found_pathname = strsave (temp_pathname); return found_file; }