Mitigate gdb bug 21057. (#2181)

See https://sourceware.org/bugzilla/show_bug.cgi?id=21057.
This commit is contained in:
LH_Mouse
2017-02-18 16:09:04 +08:00
committed by Алексей
parent 31ea01c9b5
commit 4e90b4944f
2 changed files with 109 additions and 3 deletions

View File

@@ -0,0 +1,103 @@
From a7e625b307a3ca3225a44a47a6e8cc0f0911ac12 Mon Sep 17 00:00:00 2001
From: Peter Foley <>
Date: Sat, 18 Feb 2017 11:50:55 +0800
Subject: [PATCH] Mitigate gdb bug 21057
See https://sourceware.org/bugzilla/show_bug.cgi?id=21057.
---
gdb/ada-exp.y | 22 ++--------------------
gdb/ada-lang.c | 2 +-
gdb/ada-lang.h | 2 +-
gdb/ada-lex.l | 2 ++
4 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index d9fcdfaac2..850b4daf16 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -33,6 +33,8 @@
too messy, particularly when such includes can be inserted at random
times by the parser generator. */
+%name-prefix "ada_"
+
%{
#include "defs.h"
@@ -50,11 +52,6 @@
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
- etc). */
-#define GDB_YY_REMAP_PREFIX ada_
-#include "yy-remap.h"
-
struct name_info {
struct symbol *sym;
struct minimal_symbol *msym;
@@ -708,21 +705,6 @@ primary : '*' primary %prec '.'
/* yylex defined in ada-lex.c: Reads one token, getting characters */
/* through lexptr. */
-/* Remap normal flex interface names (yylex) as well as gratuitiously */
-/* global symbol names, so we can have multiple flex-generated parsers */
-/* in gdb. */
-
-/* (See note above on previous definitions for YACC.) */
-
-#define yy_create_buffer ada_yy_create_buffer
-#define yy_delete_buffer ada_yy_delete_buffer
-#define yy_init_buffer ada_yy_init_buffer
-#define yy_load_buffer_state ada_yy_load_buffer_state
-#define yy_switch_to_buffer ada_yy_switch_to_buffer
-#define yyrestart ada_yyrestart
-#define yytext ada_yytext
-#define yywrap ada_yywrap
-
static struct obstack temp_parse_space;
/* The following kludge was found necessary to prevent conflicts between */
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 502710a462..50344ad710 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -14060,7 +14060,7 @@ const struct language_defn ada_language_defn = {
ada_extensions,
&ada_exp_descriptor,
parse,
- ada_yyerror,
+ ada_error,
resolve,
ada_printchar, /* Print a character constant */
ada_printstr, /* Function to print string constant */
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 794a282da8..681229ba8e 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -159,7 +159,7 @@ extern int ada_get_field_index (const struct type *type,
extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
-extern void ada_yyerror (char *); /* Defined in ada-exp.y */
+extern void ada_error (char *); /* Defined in ada-exp.y */
/* Defined in ada-typeprint.c */
extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 0825290214..aa6bb2d269 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -39,6 +39,8 @@ OPER ([-+*/=<>&]|"<="|">="|"**"|"/="|"and"|"or"|"xor"|"not"|"mod"|"rem"|"abs"
EXP (e[+-]{NUM10})
POSEXP (e"+"?{NUM10})
+%option prefix="ada_"
+
%{
#define NUMERAL_WIDTH 256
--
2.11.1

View File

@@ -5,7 +5,7 @@ _realname=gdb
_gcc_ver=$(gcc -v 2>&1 | grep "^gcc version" | head -n1 | cut -c 13- | sed -r "s/\\s.*$//")
pkgbase=mingw-w64-${_realname}
_base_ver=7.11
pkgver=7.11.r88491.9c542c2
pkgver=7.11.r89678.9e9a4e9c23
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-git")
replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}=${pkgver}")
@@ -30,13 +30,15 @@ source=("${_realname}"::"git://sourceware.org/git/binutils-gdb.git#branch=master
0001-MinGW-w64-Two-fixes-for-unusual-files.patch
0002-MinGW-w64-Fix-libibery-configure.patch
0003-MinGW-w64-Use-gnu-printf.patch
0004-GDB-performance.patch)
0004-GDB-performance.patch
0005-Mitigate-gdb-bug-21057.patch)
sha256sums=('SKIP'
'dea2bbad4967280910559c6a11b865aeec19cab34647fb5894cb498b24b14462'
'c88dcddafcb217a1f933b786a01fb6261adae7841aaddac1c2d96bdc259f00b6'
'c92183a52f53d82cb5ffddf2a18f5bddd350ccc0db01eff1e5918d98467ee8e3'
'c8aab67618e05c31e3b60b59319d8fa3eeb7ca9dbf8de937a07c99533557dd5f'
'4ddb55be45625efd1b2c82d2e344f4ebc9f17e362642489f21eb19fa9ec8d94b')
'4ddb55be45625efd1b2c82d2e344f4ebc9f17e362642489f21eb19fa9ec8d94b'
'addd8393922ac9d67f168c2a2748d4de3e1d7283a098b5afac5a852ea4056233')
pkgver() {
cd "$srcdir/$_realname"
@@ -49,6 +51,7 @@ prepare() {
git am "${srcdir}"/0002-MinGW-w64-Fix-libibery-configure.patch
git am "${srcdir}"/0003-MinGW-w64-Use-gnu-printf.patch
git am "${srcdir}"/0004-GDB-performance.patch
git am "${srcdir}"/0005-Mitigate-gdb-bug-21057.patch
}
build() {