Re: [RFA] [1/2] auto-loading scripts from .debug_gdb_scripts section

Doug Evans
2010-04-20T21:45:58Z

On Fri, Apr 16, 2010 at 2:25 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Fri, 16 Apr 2010 11:06:44 -0700
>> From: Doug Evans <dje@google.com>
>> Cc: gdb-patches@sourceware.org
>>
>> > The existing Python Auto-loading section is not too long, so how about
>> > simply adding the description of this new feature to that section?  I
>> > think ripping it out of "Python API" is not a good idea.
>>
>> To me the Auto-loading section is not really part of the API.
>
> Well, yes, but this feature is currently specific to Python, so why
> move it out of the Python chapter?

I moved it from the "Python API" node to the "Python" node.
It's up one level but it's still in the Python chapter.

>> >> +  if (!input && debug_file_directory)
>> >> +    {
>> >> +      /* Also try the same file in the separate debug info directory.  */
>> >> +      debugfile = xmalloc (strlen (filename)
>> >> +                        + strlen (debug_file_directory) + 1);
>> >> +      strcpy (debugfile, debug_file_directory);
>> >> +      /* FILENAME is absolute, so we don't need a "/" here.  */
>> >> +      strcat (debugfile, filename);
>> >
>> > What will that last strcat do if FILENAME has a drive letter?
>> >
>> >> +      strcpy (debugfile, gdb_datadir);
>> >> +      strcat (debugfile, "/auto-load");
>> >> +      /* FILENAME is absolute, so we don't need a "/" here.  */
>> >> +      strcat (debugfile, filename);
>> >
>> > Ditto.
>>
>> This is cut-n-pasted from the existing code to auto-load -gdb.py
>> scripts.  I don't know if filename can have a drive letter here.
>
> Yes, it can.  It depends how the files were called out in the
> compilation command line.
>
> I think we should strip the drive letter and the colon before
> concatenating the rest with the leading directory.

Sure.
I'll do that.