• Is this my failure or of the compiler's debugger

    From ldries46@21:1/5 to All on Tue Jan 10 14:16:12 2023
    This is a multi-part message in MIME format.
    I try to create a program that read Unbounded strings from a file in the
    loop:
          Open(C_File, In_File, To_String(Inp_File));
          while not End_of_File(C_File) loop
             str_line_n := To_Unbounded_String(Get_Line(C_File));
             Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this line
             glade_lines := glade_lines + 1;
          end loop;
          Close(C_File);
    where str_line_n is of the type Unbounded_String.
    I used a test file with the below presented three text lines:
    Line 1 abcdef9876543210
    Line 2 " abcdef"9876543210
    Line 3 "abc"de"f"9876543210

    In the debugger the results were:
    "Line 1 abcdef 9876543210"
    "Line 2 "" abcdef"" 98765432"
    "Line 3 ""abc""de ""f""987654"

    I used:
    GNAT Studio 23.0w (20220512) hosted on x86_64-w64-mingw32
    GNAT Community 2021 (20210519-103) targeting x86_64-w64-mingw32
    SPARK Community 2021 (20210519)

    My questions are:

    * Are the double quotes problems for the debugger.
    * Are the double quotes problems for reader subroutine.
    * How can I see the real values in the debugger.

    What is the most simple way to solve this problem.

    <html>
    <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <font face="Monospac821 BT">I try to create a program that read
    Unbounded strings from a file in the loop:<br>
          Open(C_File, In_File, To_String(Inp_File));<br>
          while not End_of_File(C_File) loop<br>
             str_line_n := To_Unbounded_String(Get_Line(C_File));<br>
             Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this
    line<br>
             glade_lines := glade_lines + 1;<br>
          end loop;<br>
          Close(C_File);<br>
    where str_line_n is of the type Unbounded_String.<br>
    I used a test file with the below presented three text lines:<br>
    Line 1 abcdef9876543210<br>
    Line 2 " abcdef"9876543210<br>
    Line 3 "abc"de"f"9876543210<br>
    <br>
    In the debugger the results were:<br>
    "Line 1 abcdef 9876543210"<br>
    "Line 2 "" abcdef"" 98765432"<br>
    "Line 3 ""abc""de ""f""987654"<br>
    <br>
    I used:<br>
    GNAT Studio 23.0w (20220512) hosted on x86_64-w64-mingw32<br>
    GNAT Community 2021 (20210519-103) targeting x86_64-w64-mingw32<br>
    SPARK Community 2021 (20210519)<br>
    <br>
    My questions are:<br>
    </font>
    <ul>
    <li><font face="Monospac821 BT">Are the double quotes problems for
    the debugger.</font></li>
    <li><font face="Monospac821 BT">Are the double quotes problems for
    reader subroutine.<br>
    </font></li>
    <li><font face="Monospac821 BT">How can I see the real values in
    the debugger.</font></li>
    </ul>
    <p><font face="Monospac821 BT">What is the most simple way to solve
    this problem.</font><br>
    </p>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to All on Tue Jan 10 07:38:14 2023
    The double quote within a string just represent one character: "
    Thus this string's length is 1 """".

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Niklas Holsti@21:1/5 to All on Tue Jan 10 20:12:07 2023
    On 2023-01-10 15:16, ldries46 wrote:
    I try to create a program that read Unbounded strings from a file in the loop:
          Open(C_File, In_File, To_String(Inp_File));
          while not End_of_File(C_File) loop
             str_line_n := To_Unbounded_String(Get_Line(C_File));
             Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this line
             glade_lines := glade_lines + 1;
          end loop;
          Close(C_File);
    where str_line_n is of the type Unbounded_String.
    I used a test file with the below presented three text lines:
    Line 1 abcdef9876543210
    Line 2 " abcdef"9876543210
    Line 3 "abc"de"f"9876543210

    In the debugger the results were:
    "Line 1 abcdef 9876543210"
    "Line 2 "" abcdef"" 98765432"
    "Line 3 ""abc""de ""f""987654"


    It seems that the debugger displays the strings in the form of Ada
    string literals, which are enclosed in quotes (") and within which each
    quote character has to be duplicated (to show that it is not the
    terminating quote). So the duplication of the quotes is nothing to worry
    about. If you were to print out the strings (with Ada.Text_IO) they
    should appear just as in the input, with only the original quote characters.

    However, your example also shows some extra blank spaces in the debugger output, for example:

    Input : Line 1 abcdef9876543210
    Debugger: "Line 1 abcdef 9876543210"

    There seems to be a new blank space between 'f' and '9'. Are you sure
    that you presented the input and output correctly?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Tue Jan 10 23:17:31 2023
    Op 10-1-2023 om 19:12 schreef Niklas Holsti:
    On 2023-01-10 15:16, ldries46 wrote:
    I try to create a program that read Unbounded strings from a file in
    the loop:
           Open(C_File, In_File, To_String(Inp_File));
           while not End_of_File(C_File) loop
              str_line_n := To_Unbounded_String(Get_Line(C_File));
              Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this line
              glade_lines := glade_lines + 1;
           end loop;
           Close(C_File);
    where str_line_n is of the type Unbounded_String.
    I used a test file with the below presented three text lines:
    Line 1 abcdef9876543210
    Line 2 " abcdef"9876543210
    Line 3 "abc"de"f"9876543210

    In the debugger the results were:
    "Line 1 abcdef 9876543210"
    "Line 2 "" abcdef"" 98765432"
    "Line 3 ""abc""de ""f""987654"


    It seems that the debugger displays the strings in the form of Ada
    string literals, which are enclosed in quotes (") and within which
    each quote character has to be duplicated (to show that it is not the terminating quote). So the duplication of the quotes is nothing to
    worry about. If you were to print out the strings (with Ada.Text_IO)
    they should appear just as in the input, with only the original quote characters.

    However, your example also shows some extra blank spaces in the
    debugger output, for example:

    Input   : Line 1 abcdef9876543210
    Debugger: "Line 1 abcdef 9876543210"



    Not only that but also some of the  last characters disappear in line 2
    the 10 and in line 3 3210

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Wed Jan 11 08:40:42 2023
    Op 10-1-2023 om 23:17 schreef ldries46:
    Op 10-1-2023 om 19:12 schreef Niklas Holsti:
    On 2023-01-10 15:16, ldries46 wrote:
    I try to create a program that read Unbounded strings from a file in
    the loop:
           Open(C_File, In_File, To_String(Inp_File));
           while not End_of_File(C_File) loop
              str_line_n := To_Unbounded_String(Get_Line(C_File));
              Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this line
              glade_lines := glade_lines + 1;
           end loop;
           Close(C_File);
    where str_line_n is of the type Unbounded_String.
    I used a test file with the below presented three text lines:
    Line 1 abcdef9876543210
    Line 2 " abcdef"9876543210
    Line 3 "abc"de"f"9876543210

    In the debugger the results were:
    "Line 1 abcdef 9876543210"
    "Line 2 "" abcdef"" 98765432"
    "Line 3 ""abc""de ""f""987654"


    It seems that the debugger displays the strings in the form of Ada
    string literals, which are enclosed in quotes (") and within which
    each quote character has to be duplicated (to show that it is not the
    terminating quote). So the duplication of the quotes is nothing to
    worry about. If you were to print out the strings (with Ada.Text_IO)
    they should appear just as in the input, with only the original quote
    characters.

    However, your example also shows some extra blank spaces in the
    debugger output, for example:

    Input   : Line 1 abcdef9876543210
    Debugger: "Line 1 abcdef 9876543210"



    Not only that but also some of the  last characters disappear in line
    2 the 10 and in line 3 3210
    In the mean time by inserting a write command to a Gtk window I found
    that the problem is really a problem of the debugger. The values in the
    Gtk window are correct. this means that in a next version of the
    debugger that must be corrected

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Niklas Holsti@21:1/5 to All on Wed Jan 11 15:43:36 2023
    On 2023-01-11 0:17, ldries46 wrote:
    Op 10-1-2023 om 19:12 schreef Niklas Holsti:
    On 2023-01-10 15:16, ldries46 wrote:
    I try to create a program that read Unbounded strings from a file in
    the loop:
           Open(C_File, In_File, To_String(Inp_File));
           while not End_of_File(C_File) loop
              str_line_n := To_Unbounded_String(Get_Line(C_File));
              Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this line
              glade_lines := glade_lines + 1;
           end loop;
           Close(C_File);
    where str_line_n is of the type Unbounded_String.
    I used a test file with the below presented three text lines:
    Line 1 abcdef9876543210
    Line 2 " abcdef"9876543210
    Line 3 "abc"de"f"9876543210

    In the debugger the results were:
    "Line 1 abcdef 9876543210"
    "Line 2 "" abcdef"" 98765432"
    "Line 3 ""abc""de ""f""987654"


    It seems that the debugger displays the strings in the form of Ada
    string literals, which are enclosed in quotes (") and within which
    each quote character has to be duplicated (to show that it is not the
    terminating quote). So the duplication of the quotes is nothing to
    worry about. If you were to print out the strings (with Ada.Text_IO)
    they should appear just as in the input, with only the original quote
    characters.

    However, your example also shows some extra blank spaces in the
    debugger output, for example:

    Input   : Line 1 abcdef9876543210
    Debugger: "Line 1 abcdef 9876543210"



    Not only that but also some of the  last characters disappear in line 2
    the 10 and in line 3 3210


    My guess is that these differences are bugs in the debugger's display of strings with embedded quote characters. For Line 1, which has no
    embedded quotes, the full string is displayed (though with an inserted
    blank). For Line 2, with two embedded quotes, two of the last characters
    are not displayed. For Line 3, with four embedded quotes, four of the
    last characters are not displayed. It seems that the debugger does not
    realize that doubling the quote characters makes the displayed string
    longer...

    Try to print the strings with Ada.Text_IO instead, that should give the
    right result. In other words, your code reading the strings works, but
    the debugger is probably buggy. (One reason why I avoid debuggers
    whenever I can.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ldries46@21:1/5 to All on Wed Jan 11 17:52:54 2023
    Op 11-1-2023 om 14:43 schreef Niklas Holsti:
    On 2023-01-11 0:17, ldries46 wrote:
    Op 10-1-2023 om 19:12 schreef Niklas Holsti:
    On 2023-01-10 15:16, ldries46 wrote:
    I try to create a program that read Unbounded strings from a file
    in the loop:
           Open(C_File, In_File, To_String(Inp_File));
           while not End_of_File(C_File) loop
              str_line_n := To_Unbounded_String(Get_Line(C_File)); >>>>           Buffer_GL.Set_Buffer(str_line_n); -- breakpoint on this line
              glade_lines := glade_lines + 1;
           end loop;
           Close(C_File);
    where str_line_n is of the type Unbounded_String.
    I used a test file with the below presented three text lines:
    Line 1 abcdef9876543210
    Line 2 " abcdef"9876543210
    Line 3 "abc"de"f"9876543210

    In the debugger the results were:
    "Line 1 abcdef 9876543210"
    "Line 2 "" abcdef"" 98765432"
    "Line 3 ""abc""de ""f""987654"


    It seems that the debugger displays the strings in the form of Ada
    string literals, which are enclosed in quotes (") and within which
    each quote character has to be duplicated (to show that it is not
    the terminating quote). So the duplication of the quotes is nothing
    to worry about. If you were to print out the strings (with
    Ada.Text_IO) they should appear just as in the input, with only the
    original quote characters.

    However, your example also shows some extra blank spaces in the
    debugger output, for example:

    Input   : Line 1 abcdef9876543210
    Debugger: "Line 1 abcdef 9876543210"



    Not only that but also some of the  last characters disappear in line
    2 the 10 and in line 3 3210


    My guess is that these differences are bugs in the debugger's display
    of strings with embedded quote characters. For Line 1, which has no
    embedded quotes, the full string is displayed (though with an inserted blank). For Line 2, with two embedded quotes, two of the last
    characters are not displayed. For Line 3, with four embedded quotes,
    four of the last characters are not displayed. It seems that the
    debugger does not realize that doubling the quote characters makes the displayed string longer...

    Try to print the strings with Ada.Text_IO instead, that should give
    the right result. In other words, your code reading the strings works,
    but the debugger is probably buggy. (One reason why I avoid debuggers whenever I can.)

    That is also my guess but I like to use the debugger because You stop
    running the program anywhere you want and check all parameters you think
    are nice to know. Now you have to add a lot of code and still see that
    you need tyo know another parameter and run the program over and over
    again each time with other code added.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)