 bfd/archive.c     |   28 ++++++++++
 bfd/coff-i386.c   |    4 ++
 bfd/coff-ia64.c   |    4 ++
 bfd/coff-ppc.c    |    8 +++
 bfd/coff-sh.c     |    8 +++
 bfd/coff-x86_64.c |    4 ++
 bfd/coffcode.h    |  156 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 bfd/libbfd-in.h   |   23 ++++++++
 bfd/libbfd.h      |   23 ++++++++
 bfd/pe-mips.c     |    4 ++
 gdb/frame.c       |   79 +++++++++++++++++++++++++++
 gdb/frame.h       |    7 +++
 gdb/source.c      |    8 +++-
 gdb/stack.c       |   22 ++++++--
 gdb/symtab.c      |   29 +++++++++-
 gdb/windows-nat.c |   26 ++++++++-
 include/md5.h     |    4 ++
 17 files changed, 427 insertions(+), 10 deletions(-)

diff --git a/bfd/archive.c b/bfd/archive.c
index ac2be3e..b688bb6 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1490,6 +1490,34 @@ _bfd_archive_coff_construct_extended_name_table (bfd *abfd,
   return _bfd_construct_extended_name_table (abfd, TRUE, tabloc, tablen);
 }
 
+/* PE-COFF long filenames are null terminated, not "/\012", which is
+   what the coff archiver function does.  So we call general function
+   without asking for terminating slashes.  Then, we replace
+   all of the '\012' characters with '\0'.
+   Information obtained from the PE-COFF Specification version 8.1,
+   section 7.5 on the Longnames member. */
+
+bfd_boolean
+_bfd_archive_pecoff_construct_extended_name_table (bfd *abfd,
+						   char **tabloc,
+						   bfd_size_type *tablen,
+						   const char **name)
+{
+  bfd_size_type i;
+  char *strptr;
+  *name = "//";
+  if (! _bfd_construct_extended_name_table (abfd, FALSE, tabloc, tablen))
+    return FALSE;
+
+  strptr = *tabloc;
+  for (i = 0; i < *tablen; ++ i)
+    {
+      if (strptr[i] == ARFMAG[1])
+        strptr[i] = '\0';
+    }
+  return TRUE;
+}
+
 /* Follows archive_head and produces an extended name table if
    necessary.  Returns (in tabloc) a pointer to an extended name
    table, and in tablen the length of the table.  If it makes an entry
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index adc3433..97f744d 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -686,7 +686,11 @@ const bfd_target
      BFD_JUMP_TABLE_GENERIC (coff),
      BFD_JUMP_TABLE_COPY (coff),
      BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
      BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
      BFD_JUMP_TABLE_SYMBOLS (coff),
      BFD_JUMP_TABLE_RELOCS (coff),
      BFD_JUMP_TABLE_WRITE (coff),
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c
index 86e7617..d3f1502 100644
--- a/bfd/coff-ia64.c
+++ b/bfd/coff-ia64.c
@@ -196,7 +196,11 @@ const bfd_target
      BFD_JUMP_TABLE_GENERIC (coff),
      BFD_JUMP_TABLE_COPY (coff),
      BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
      BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
      BFD_JUMP_TABLE_SYMBOLS (coff),
      BFD_JUMP_TABLE_RELOCS (coff),
      BFD_JUMP_TABLE_WRITE (coff),
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index b37a224..91c6f84 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -2601,7 +2601,11 @@ const bfd_target TARGET_LITTLE_SYM =
   BFD_JUMP_TABLE_GENERIC (coff),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (coff),
   BFD_JUMP_TABLE_RELOCS (coff),
   BFD_JUMP_TABLE_WRITE (coff),
@@ -2661,7 +2665,11 @@ const bfd_target TARGET_BIG_SYM =
   BFD_JUMP_TABLE_GENERIC (coff),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (coff),
   BFD_JUMP_TABLE_RELOCS (coff),
   BFD_JUMP_TABLE_WRITE (coff),
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index e707add..8c185d2 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -3203,7 +3203,11 @@ const bfd_target shcoff_small_vec =
   BFD_JUMP_TABLE_GENERIC (coff_small),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (coff),
   BFD_JUMP_TABLE_RELOCS (coff),
   BFD_JUMP_TABLE_WRITE (coff),
@@ -3248,7 +3252,11 @@ const bfd_target shlcoff_small_vec =
   BFD_JUMP_TABLE_GENERIC (coff_small),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (coff),
   BFD_JUMP_TABLE_RELOCS (coff),
   BFD_JUMP_TABLE_WRITE (coff),
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 4f00b78..41b82f6 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -784,7 +784,11 @@ const bfd_target
   BFD_JUMP_TABLE_GENERIC (coff),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (coff),
   BFD_JUMP_TABLE_RELOCS (coff),
   BFD_JUMP_TABLE_WRITE (coff),
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 62eeb20..6c37328 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5683,6 +5683,10 @@ static bfd_coff_backend_data ticoff1_swap_table =
 #define coff_bfd_define_common_symbol	    bfd_generic_define_common_symbol
 #endif
 
+/* Define the PE-COFF generators with the correct tables. */
+
+#ifndef COFF_WITH_PE
+
 #define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE)	\
 const bfd_target VAR =							\
 {									\
@@ -5833,3 +5837,155 @@ const bfd_target VAR =							\
 									\
   SWAP_TABLE								\
 };
+
+#else /* COFF_WITH_PE */
+
+#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE)	\
+const bfd_target VAR =							\
+{									\
+  NAME ,								\
+  bfd_target_coff_flavour,						\
+  BFD_ENDIAN_BIG,		/* Data byte order is big.  */		\
+  BFD_ENDIAN_BIG,		/* Header byte order is big.  */	\
+  /* object flags */							\
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |			\
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),			\
+  /* section flags */							\
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
+  UNDER,			/* Leading symbol underscore.  */	\
+  '/',				/* AR_pad_char.  */			\
+  15,				/* AR_max_namelen.  */			\
+									\
+  /* Data conversion functions.  */					\
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,				\
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,				\
+									\
+  /* Header conversion functions.  */					\
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,				\
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,				\
+									\
+	/* bfd_check_format.  */					\
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p,		\
+    _bfd_dummy_target },						\
+	/* bfd_set_format.  */						\
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },	\
+	/* bfd_write_contents.  */					\
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents,	\
+    bfd_false },							\
+									\
+  BFD_JUMP_TABLE_GENERIC (coff),					\
+  BFD_JUMP_TABLE_COPY (coff),						\
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),					\
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),				\
+  BFD_JUMP_TABLE_SYMBOLS (coff),					\
+  BFD_JUMP_TABLE_RELOCS (coff),						\
+  BFD_JUMP_TABLE_WRITE (coff),						\
+  BFD_JUMP_TABLE_LINK (coff),						\
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),				\
+									\
+  ALTERNATIVE,								\
+									\
+  SWAP_TABLE								\
+};
+
+#define CREATE_BIGHDR_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE)	\
+const bfd_target VAR =							\
+{									\
+  NAME ,								\
+  bfd_target_coff_flavour,						\
+  BFD_ENDIAN_LITTLE,		/* Data byte order is little.  */	\
+  BFD_ENDIAN_BIG,		/* Header byte order is big.  */	\
+  /* object flags */							\
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |			\
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),			\
+  /* section flags */							\
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
+  UNDER,			/* Leading symbol underscore.  */	\
+  '/',				/* AR_pad_char.  */			\
+  15,				/* AR_max_namelen.  */			\
+									\
+  /* Data conversion functions.  */					\
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,				\
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,				\
+									\
+  /* Header conversion functions.  */					\
+  bfd_getb64, bfd_getb_signed_64, bfd_putb64,				\
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,				\
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,				\
+									\
+	/* bfd_check_format.  */					\
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p,		\
+    _bfd_dummy_target },						\
+	/* bfd_set_format.  */						\
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },	\
+	/* bfd_write_contents.  */					\
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents,	\
+    bfd_false },							\
+									\
+  BFD_JUMP_TABLE_GENERIC (coff),					\
+  BFD_JUMP_TABLE_COPY (coff),						\
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),					\
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),				\
+  BFD_JUMP_TABLE_SYMBOLS (coff),					\
+  BFD_JUMP_TABLE_RELOCS (coff),						\
+  BFD_JUMP_TABLE_WRITE (coff),						\
+  BFD_JUMP_TABLE_LINK (coff),						\
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),				\
+									\
+  ALTERNATIVE,								\
+									\
+  SWAP_TABLE								\
+};
+
+#define CREATE_LITTLE_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE)	\
+const bfd_target VAR =							\
+{									\
+  NAME ,								\
+  bfd_target_coff_flavour,						\
+  BFD_ENDIAN_LITTLE,		/* Data byte order is little.  */	\
+  BFD_ENDIAN_LITTLE,		/* Header byte order is little.  */	\
+	/* object flags */						\
+  (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG |			\
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS),			\
+	/* section flags */						\
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\
+  UNDER,			/* Leading symbol underscore.  */	\
+  '/',				/* AR_pad_char.  */			\
+  15,				/* AR_max_namelen.  */			\
+									\
+  /* Data conversion functions.  */					\
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,				\
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,				\
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16,				\
+  /* Header conversion functions.  */					\
+  bfd_getl64, bfd_getl_signed_64, bfd_putl64,				\
+  bfd_getl32, bfd_getl_signed_32, bfd_putl32,				\
+  bfd_getl16, bfd_getl_signed_16, bfd_putl16,				\
+	/* bfd_check_format.  */					\
+  { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p,		\
+    _bfd_dummy_target },						\
+       /* bfd_set_format.  */						\
+  { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false },	\
+	/* bfd_write_contents.  */					\
+  { bfd_false, coff_write_object_contents, _bfd_write_archive_contents,	\
+    bfd_false },							\
+									\
+  BFD_JUMP_TABLE_GENERIC (coff),					\
+  BFD_JUMP_TABLE_COPY (coff),						\
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),					\
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),				\
+  BFD_JUMP_TABLE_SYMBOLS (coff),					\
+  BFD_JUMP_TABLE_RELOCS (coff),						\
+  BFD_JUMP_TABLE_WRITE (coff),						\
+  BFD_JUMP_TABLE_LINK (coff),						\
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),				\
+									\
+  ALTERNATIVE,								\
+									\
+  SWAP_TABLE								\
+};
+
+#endif /* COFF_WITH_PE */
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index f7a9e21..82c4a3b 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -331,6 +331,29 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
   bfd_generic_stat_arch_elt
 #define _bfd_archive_coff_update_armap_timestamp bfd_true
 
+/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get PE-COFF style
+   archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff).
+   Unless overridden, they default to the COFF functions.  */
+
+#define _bfd_archive_pecoff_slurp_armap _bfd_archive_coff_slurp_armap
+#define _bfd_archive_pecoff_slurp_extended_name_table \
+  _bfd_archive_coff_slurp_extended_name_table
+extern bfd_boolean _bfd_archive_pecoff_construct_extended_name_table
+  (bfd *, char **, bfd_size_type *, const char **);
+#define _bfd_archive_pecoff_truncate_arname \
+  _bfd_archive_coff_truncate_arname
+#define _bfd_archive_pecoff_write_armap _bfd_archive_coff_write_armap
+#define _bfd_archive_pecoff_read_ar_hdr _bfd_archive_coff_read_ar_hdr
+#define _bfd_archive_pecoff_write_ar_hdr _bfd_archive_coff_write_ar_hdr
+#define _bfd_archive_pecoff_openr_next_archived_file \
+  _bfd_archive_coff_openr_next_archived_file
+#define _bfd_archive_pecoff_get_elt_at_index \
+  _bfd_archive_coff_get_elt_at_index
+#define _bfd_archive_pecoff_generic_stat_arch_elt \
+  _bfd_archive_coff_generic_stat_arch_elt
+#define _bfd_archive_pecoff_update_armap_timestamp \
+  _bfd_archive_coff_update_armap_timestamp
+
 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44).  */
 
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index a10a651..646c0fd 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -336,6 +336,29 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
   bfd_generic_stat_arch_elt
 #define _bfd_archive_coff_update_armap_timestamp bfd_true
 
+/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get PE-COFF style
+   archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff).
+   Unless overridden, they default to the COFF functions.  */
+
+#define _bfd_archive_pecoff_slurp_armap _bfd_archive_coff_slurp_armap
+#define _bfd_archive_pecoff_slurp_extended_name_table \
+  _bfd_archive_coff_slurp_extended_name_table
+extern bfd_boolean _bfd_archive_pecoff_construct_extended_name_table
+  (bfd *, char **, bfd_size_type *, const char **);
+#define _bfd_archive_pecoff_truncate_arname \
+  _bfd_archive_coff_truncate_arname
+#define _bfd_archive_pecoff_write_armap _bfd_archive_coff_write_armap
+#define _bfd_archive_pecoff_read_ar_hdr _bfd_archive_coff_read_ar_hdr
+#define _bfd_archive_pecoff_write_ar_hdr _bfd_archive_coff_write_ar_hdr
+#define _bfd_archive_pecoff_openr_next_archived_file \
+  _bfd_archive_coff_openr_next_archived_file
+#define _bfd_archive_pecoff_get_elt_at_index \
+  _bfd_archive_coff_get_elt_at_index
+#define _bfd_archive_pecoff_generic_stat_arch_elt \
+  _bfd_archive_coff_generic_stat_arch_elt
+#define _bfd_archive_pecoff_update_armap_timestamp \
+  _bfd_archive_coff_update_armap_timestamp
+
 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
    archives.  Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44).  */
 
diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c
index 2025e7d..1572acc 100644
--- a/bfd/pe-mips.c
+++ b/bfd/pe-mips.c
@@ -910,7 +910,11 @@ const bfd_target
   BFD_JUMP_TABLE_GENERIC (coff),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
+#ifndef COFF_WITH_PE
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#else
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_pecoff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (coff),
   BFD_JUMP_TABLE_RELOCS (coff),
   BFD_JUMP_TABLE_WRITE (coff),
diff --git a/gdb/frame.c b/gdb/frame.c
index 2bb843e..63ff4a1 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -44,6 +44,7 @@
 #include "block.h"
 #include "inline-frame.h"
 #include  "tracepoint.h"
+#include "filenames.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -135,6 +136,19 @@ struct frame_info
    sufficient for now.  */
 static struct frame_info *frame_stash = NULL;
 
+/* Possible values of 'set backtrace filename-display'.  */
+static const char filename_display_full[] = "full";
+static const char filename_display_basename[] = "basename";
+static const char filename_display_without_comp_directory[] = "without-compilation-directory";
+
+static const char *filename_display_kind_names[] = {
+  filename_display_full,
+  filename_display_basename,
+  filename_display_without_comp_directory,
+  NULL
+};
+
+
 /* Add the following FRAME to the frame stash.  */
 
 static void
@@ -207,6 +221,16 @@ show_backtrace_limit (struct ui_file *file, int from_tty,
 		    value);
 }
 
+static const char *filename_display_string = filename_display_full;
+
+static void
+show_filename_display_string (struct ui_file *file, int from_tty,
+			      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+		    _("A filename is displayed in backtrace as \"%s\".\n"),
+		    value);
+}
 
 static void
 fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
@@ -217,6 +241,8 @@ fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr)
     fprintf_unfiltered (file, "!%s", name);
 }
 
+
+
 void
 fprint_frame_id (struct ui_file *file, struct frame_id id)
 {
@@ -2118,6 +2144,42 @@ find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
   (*sal) = find_pc_line (pc, notcurrent);
 }
 
+/* See commentary in frame.h.  */
+
+const char *
+get_filename_display_from_sal (struct symtab_and_line *sal)
+{
+  const char *filename = sal->symtab->filename;
+  const char *dirname = sal->symtab->dirname;
+  size_t dlen = dirname ? strlen (dirname) : 0;
+
+  if (filename == NULL)
+    {
+      return NULL;
+    }
+  else if (filename_display_string == filename_display_basename)
+    {
+      return lbasename (filename);
+    }
+  else if (filename_display_string == filename_display_without_comp_directory
+      && dirname && dlen && dlen <= strlen (filename)
+      && !filename_ncmp (filename, dirname, dlen))
+    {
+      const char *start = filename + dlen;
+      const char *result = start;
+      while (IS_DIR_SEPARATOR (*result))
+	result++;
+
+      if (IS_DIR_SEPARATOR (dirname[dlen - 1]))
+	return result;
+      else
+	return result == start ? filename : result;
+    }
+
+  return filename;
+}
+
+
 /* Per "frame.h", return the ``address'' of the frame.  Code should
    really be using get_frame_id().  */
 CORE_ADDR
@@ -2476,6 +2538,23 @@ Zero is unlimited."),
 			   show_backtrace_limit,
 			   &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
+			   
+
+  add_setshow_enum_cmd ("filename-display", class_obscure,
+			filename_display_kind_names,
+			&filename_display_string, _("\
+Set a way how to display filename."), _("\
+Show a way how to display filename."), _("\
+filename-display can be:\n\
+  full                           - display a full filename, this is the default\n\
+  basename                       - display only basename of a filename\n\
+  without-compilation-directory  - display a filename without the compilation directory part\n\
+By default, full filename is displayed."),
+			NULL,
+			show_filename_display_string,
+			&set_backtrace_cmdlist,
+			&show_backtrace_cmdlist);
+			   
 
   /* Debug this files internals.  */
   add_setshow_zinteger_cmd ("frame", class_maintenance, &frame_debug,  _("\
diff --git a/gdb/frame.h b/gdb/frame.h
index 67dddbd..acaf427 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -353,6 +353,13 @@ extern int get_frame_func_if_available (struct frame_info *fi, CORE_ADDR *);
 extern void find_frame_sal (struct frame_info *frame,
 			    struct symtab_and_line *sal);
 
+/* Returns either full filename or basename or filename
+   without compile directory part.
+   It depends on 'set backtrace filename-display' value.  */
+
+extern const char *get_filename_display_from_sal (struct symtab_and_line *sal);
+
+			  
 /* Set the current source and line to the location given by frame
    FRAME, if possible.  When CENTER is true, adjust so the relevant
    line is in the center of the next 'list'.  */
diff --git a/gdb/source.c b/gdb/source.c
index 909f252..c995bf3 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -999,6 +999,7 @@ find_and_open_source (const char *filename,
   char *path = source_path;
   const char *p;
   int result;
+  char *lpath;
 
   /* Quick way out if we already know its full name.  */
 
@@ -1017,7 +1018,12 @@ find_and_open_source (const char *filename,
 
       result = open (*fullname, OPEN_MODE);
       if (result >= 0)
-	return result;
+      {
+        lpath = gdb_realpath(*fullname);
+        xfree(*fullname);
+        *fullname = lpath;
+        return result;
+      }
       /* Didn't work -- free old one, try again.  */
       xfree (*fullname);
       *fullname = NULL;
diff --git a/gdb/stack.c b/gdb/stack.c
index b15b5fc..cae6094 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1173,15 +1173,23 @@ print_frame (struct frame_info *frame, int print_level,
   ui_out_text (uiout, ")");
   if (sal.symtab && sal.symtab->filename)
     {
+      const char *filename_display = get_filename_display_from_sal (&sal);
+
+      if (filename_display == NULL)
+	  filename_display = sal.symtab->filename;
+
+      
       annotate_frame_source_begin ();
       ui_out_wrap_hint (uiout, "   ");
       ui_out_text (uiout, " at ");
       annotate_frame_source_file ();
-      ui_out_field_string (uiout, "file", sal.symtab->filename);
-      if (ui_out_is_mi_like_p (uiout))
+      ui_out_field_string (uiout, "file", filename_display);
+      
+        
+        if (ui_out_is_mi_like_p (uiout))
 	{
-	  const char *fullname = symtab_to_fullname (sal.symtab);
-
+	  const char *fullname;
+	  fullname = symtab_to_fullname (sal.symtab);
 	  if (fullname != NULL)
 	    ui_out_field_string (uiout, "fullname", fullname);
 	}
@@ -1817,6 +1825,10 @@ iterate_over_block_locals (struct block *b,
 {
   struct dict_iterator iter;
   struct symbol *sym;
+  struct frame_info *frame;
+  struct symtab_and_line sal;
+  frame = get_selected_frame (NULL) ;
+  find_frame_sal (frame, &sal);
 
   ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
@@ -1828,6 +1840,8 @@ iterate_over_block_locals (struct block *b,
 	case LOC_COMPUTED:
 	  if (SYMBOL_IS_ARGUMENT (sym))
 	    break;
+	  if(sym->line>= sal.line)
+            break;
 	  (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
 	  break;
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 1746d69..cdec5a2 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1840,6 +1840,8 @@ lookup_block_symbol (const struct block *block, const char *name,
 {
   struct dict_iterator iter;
   struct symbol *sym;
+  struct frame_info *frame;
+  struct symtab_and_line sal;
 
   if (!BLOCK_FUNCTION (block))
     {
@@ -1849,7 +1851,20 @@ lookup_block_symbol (const struct block *block, const char *name,
 	{
 	  if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
 				     SYMBOL_DOMAIN (sym), domain))
-	    return sym;
+	    {
+	       if(SYMBOL_CLASS (sym)==LOC_LOCAL
+	          ||SYMBOL_CLASS (sym)==LOC_REGISTER
+		  ||SYMBOL_CLASS (sym)==LOC_COMPUTED)	  
+	       {
+		   frame = get_selected_frame (NULL) ;
+		   find_frame_sal (frame, &sal);
+		   if( block == get_frame_block (frame, 0) 
+		      && sym->line >= sal.line)
+			return NULL;
+	       }
+	       return sym;
+	    }
+	    
 	}
       return NULL;
     }
@@ -1873,7 +1888,17 @@ lookup_block_symbol (const struct block *block, const char *name,
 	      sym_found = sym;
 	      if (!SYMBOL_IS_ARGUMENT (sym))
 		{
-		  break;
+		   if(SYMBOL_CLASS (sym)==LOC_LOCAL
+	              ||SYMBOL_CLASS (sym)==LOC_REGISTER
+		      ||SYMBOL_CLASS (sym)==LOC_COMPUTED)
+	           {
+			  frame = get_selected_frame (NULL) ;
+			  find_frame_sal (frame, &sal);
+			  if(block == get_frame_block (frame, 0) 
+			  && sym->line >= sal.line)
+			       sym_found = NULL;
+	           }
+		   break;
 		}
 	    }
 	}
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 140be38..a68ef36 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -275,9 +275,29 @@ windows_set_context_register_offsets (const int *offsets)
 static void
 check (BOOL ok, const char *file, int line)
 {
-  if (!ok)
-    printf_filtered ("error return %s:%d was %lu\n", file, line,
-		     GetLastError ());
+  const char *msg = "Unspecified error.";
+  unsigned long err;
+  char buf[1025];
+  size_t size;
+
+  if (ok)
+    return;
+
+  err = GetLastError();
+  size = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
+			| FORMAT_MESSAGE_IGNORE_INSERTS,
+			NULL,
+			err,
+			MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
+			buf, (sizeof (buf) - 1) / sizeof (TCHAR), NULL);
+  if (size > 0 && buf[size - 1] == '\n')
+    buf[--size] = '\0';
+  if (size > 0 && buf[size - 1] == '\r')
+    buf[--size] = '\0';
+  if (size > 0)
+    msg = buf;
+
+  printf_filtered ("error return %s:%d was: %s (%lu)\n", file, line, msg, err);
 }
 
 /* Find a thread record given a thread id.  If GET_CONTEXT is not 0,
diff --git a/include/md5.h b/include/md5.h
index b3ff4e1..9981f75 100644
--- a/include/md5.h
+++ b/include/md5.h
@@ -69,8 +69,12 @@ typedef uintptr_t md5_uintptr;
 # endif
 /* We have to make a guess about the integer type equivalent in size
    to pointers which should always be correct.  */
+#ifdef _WIN64
+typedef unsigned long long md5_uintptr;
+#else
 typedef unsigned long int md5_uintptr;
 #endif
+#endif
 
 #ifdef __cplusplus
 extern "C" {
