From 29192f7b77e67ae3bee0138bd0f7262e899226ab Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 25 May 2018 09:04:32 +0000 Subject: [PATCH] [Ada] Strip too long expressions in debug routines 2018-05-25 Arnaud Charlet gcc/ada/ * pprint.adb (Expression_Name): Strip too long expressions to avoid carrying very large strings. From-SVN: r260732 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/pprint.adb | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f3a0f38de6c..256ecb83c6d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-05-25 Arnaud Charlet + + * pprint.adb (Expression_Name): Strip too long expressions to avoid + carrying very large strings. + 2018-05-25 Patrick Bernardi * switch-b.adb (Scan_Binder_Switches): binder switch -Q accepts Natural diff --git a/gcc/ada/pprint.adb b/gcc/ada/pprint.adb index 24c9aa1e447..230a3d37c40 100644 --- a/gcc/ada/pprint.adb +++ b/gcc/ada/pprint.adb @@ -883,6 +883,7 @@ package body Pprint is end if; declare + Threshold : constant := 256; Buffer : String (1 .. Natural (End_Sloc - Scn)); Index : Natural := 0; Skipping_Comment : Boolean := False; @@ -935,6 +936,12 @@ package body Pprint is end if; end case; + -- Give up on too long strings + + if Index >= Threshold then + return Buffer (1 .. Index) & "..."; + end if; + Scn := Scn + 1; end loop; end if; -- 2.30.2