This is the mail archive of the gdb-patches@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: [PATCH] Guard against 'current_directory == NULL' on gdb_abspath (PR gdb/23613)


>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> So I fixed the problem with the patch below.  The idea is that, if
Sergio> 'current_directory' is NULL, then the final string returned should be
Sergio> just the "path".

I found other spots relying on current_directory in this way, so I
wonder if this is the best approach.

For example, corelow.c:

  gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
  if (!IS_ABSOLUTE_PATH (filename.get ()))
    filename.reset (concat (current_directory, "/",
			    filename.get (), (char *) NULL));

I guess this should just be converted to gdb_abspath?

... but also code in source.c and some other spots.


If this approach is the right one -- and it seems like it could be --
then the function documentation should at least be updated to reflect
this error case.

Tom


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