]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/exec.c
hurd: unwinding support over signal trampolines
[thirdparty/binutils-gdb.git] / gdb / exec.c
index 932270a000d0585374414ce4f46e4cd1690705ab..ee13c5e027efc29eb07843b8c5474e60fd6a043d 100644 (file)
@@ -435,6 +435,7 @@ exec_file_attach (const char *filename, int from_tty)
 #if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
          if (scratch_chan < 0)
            {
+             int first_errno = errno;
              char *exename = (char *) alloca (strlen (filename) + 5);
 
              strcat (strcpy (exename, filename), ".exe");
@@ -443,6 +444,8 @@ exec_file_attach (const char *filename, int from_tty)
                                    O_RDWR | O_BINARY
                                    : O_RDONLY | O_BINARY,
                                    &scratch_storage);
+             if (scratch_chan < 0)
+               errno = first_errno;
            }
 #endif
          if (scratch_chan < 0)
@@ -648,8 +651,7 @@ build_section_table (struct bfd *some_bfd, struct target_section **start,
   unsigned count;
 
   count = bfd_count_sections (some_bfd);
-  if (*start)
-    xfree (* start);
+  xfree (*start);
   *start = XNEWVEC (struct target_section, count);
   *end = *start;
   bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
@@ -1173,7 +1175,8 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
   table = current_target_sections;
   for (p = table->sections; p < table->sections_end; p++)
     {
-      if (filename_cmp (filename, p->the_bfd_section->owner->filename) == 0
+      if (filename_cmp (filename,
+                       bfd_get_filename (p->the_bfd_section->owner)) == 0
          && index == p->the_bfd_section->index)
        {
          p->endaddr += address - p->addr;