bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: segmentation violation in debug mode when watching for an index of a


From: Pascal Maugis
Subject: Re: segmentation violation in debug mode when watching for an index of an array and rerunning
Date: Mon, 19 Sep 2022 09:47:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

Hi Arnold,

sorry for not having tested that behavior with the top--newest release as I should have, but that's cool from you to have explained the progress.Having no core dump anymore is less worrying and a kind of relief :)

I understand the difficulty of co-developping, while we rely on a few guys that might leave anytime. If I were consistent as a user, I would enter the debbuger code and make the modification myself. So I'm not going to throw stones at anybody.

Anyway, you've done a great job. I can make do with that small bug. rerunning is not so annoying, and watch points remain pretty useful and manageable that way.

Cheers,

Pascal.

Le 17/09/2022 à 21:19, arnold@skeeve.com a écrit :
Hello.

Thanks for the report.

Please try the latest release, 5.2.0, made about 2 weeks ago. Here
is what I get:

        $ cat a.awk
        a[1] = 2

        $ ./gawk --debug -f a.awk
        gawk> b 1
        Breakpoint 1 set at file `a.awk', line 1
        gawk> run
        Starting program:
        
        Stopping in Rule ...
        Breakpoint 1, main() at `a.awk':1
        1       a[1] = 2
        gawk> watch a[1]
        Watchpoint 2: a["1"]
        gawk> run
        Program already running. Restart from beginning (y/n)? y
        Restarting ...
        Starting program:
        Program exited normally with exit value: 0

Now, exiting right away isn't lovely, but at least it's not a core dump.
(I will explore it further.)

In general, watchpoints are pretty fragile.  The debugger was written
by another developer who abandoned the project a long time ago, and is
perhaps the part of gawk I am least familiar with, unfortunately.

Arnold

Pascal Maugis<pascal.maugis@lsce.ipsl.fr>  wrote:

In debug mode, watching for operation on the index of an array is
possible (et very usefull). However, when rerunning the program while
the watch is still active leads to segmentation violation :

     zsh> echo "a[1]=2" >! a.awk
     zsh> gawk -D -f ./a.awk
     *gawk> b *1
      ?????? Point d'arret 1 defini dans le fichier ????./a.awk???? ligne 1
     *gawk> r*
      ?????? Demarrage du programme??:
      ?????? Arr??t dans Rule...
      ?????? Breakpoint 1, main() ?? ????./a.awk????:1
      ?????? 1???????????? a[1]
     gawk> n
     gawk> w a[1]
     Watchpoint 2: a["1"]
     gawk> r
      ?????? Programme en cours. Reprendre depuis le debut (o/n)??? o
     *?????? gawk: fatal??: erreur interne??: erreur de segmentation*
      ?????? [2]?????? 1001153 abort (core dumped)?? gawk -D -f ./a.awk

Obviously, after rerun, 'watch' points to an adress which is not
allocated anymore (which is logic). I guess watchpoints on array indexes
should be disabled on rerun, or reenabled only when the array is defined
again as such. Watching a whole array ('watch a') works fine.

Cheers,

Pascal.

Le 13/09/2022 ?? 12:42, Pascal Maugis a ??crit??:
Hi, as promised here is the strange, unexpected behavior of ++ that
looks like an error to me, because in "a ++b", a is incremented
instead of b. "a b++" and "a++ b" produce the correct results however :

     touch a.awk
     gawk -D -f ./a.awk
     eval "a=1 ; b=2"
     eval "print a ++b"???? ; output = 12 : (variables will be
     incremented after the operation, ok with me as documented)
     eval "print a b"???????? ; output = 22 : a has been incremented
     instead of b
     eval "print a++b"?????? ; output = 22 :
     eval "print a b"???????? ; output = 32 : a has been incremented

The operation seems to be interpreted as "a++b", the space been
uninterpreted as a separator

Thanks for your insight,

Cheers,

Pascal.

--
------------------------------------------------------------------------

*Pascal MAUGIS*
Mod??lisation hydrologique et changement climatique, PhD

LSCE

Laboratoire des Sciences du Climat et de l'Environnement
<http://www.lsce.ipsl.fr/>

Unit?? Mixte de Recherche CEA-CNRS-UVSQ (UMR 8212), IPSL, Paris-Saclay
Equipe MOSAIC : MOdelisation des SurfAces et Interfaces Continentales
B??t. 714, pi??ce 2115
C.E. Saclay, Orme des Merisiers, 91191 Gif-sur-Yvette Cedex, FRANCE

e-mail :pascal.maugis@lsce.ipsl.fr
Page perso : FR<http://www.lsce.ipsl.fr/Pisp/pascal.maugis/>  - EN
<http://www.lsce.ipsl.fr/en/Phocea/Pisp/index.php?nom=pascal.maugis>
Tel./Fax : +33 1 69 08 75 24 / +33 1 69 08 77 16

------------------------------------------------------------------------
--
------------------------------------------------------------------------

*Pascal MAUGIS*
Mod??lisation hydrologique et changement climatique, PhD

LSCE

Laboratoire des Sciences du Climat et de l'Environnement
<http://www.lsce.ipsl.fr/>

Unit?? Mixte de Recherche CEA-CNRS-UVSQ (UMR 8212), IPSL, Paris-Saclay
Equipe MOSAIC : MOdelisation des SurfAces et Interfaces Continentales
B??t. 714, pi??ce 2115
C.E. Saclay, Orme des Merisiers, 91191 Gif-sur-Yvette Cedex, FRANCE

e-mail :pascal.maugis@lsce.ipsl.fr
Page perso : FR<http://www.lsce.ipsl.fr/Pisp/pascal.maugis/>  - EN
<http://www.lsce.ipsl.fr/en/Phocea/Pisp/index.php?nom=pascal.maugis>
Tel./Fax : +33 1 69 08 75 24 / +33 1 69 08 77 16

------------------------------------------------------------------------
--
------------------------------------------------------------------------

*Pascal MAUGIS*
Modélisation hydrologique et changement climatique, PhD

LSCE

Laboratoire des Sciences du Climat et de l'Environnement <http://www.lsce.ipsl.fr/>

Unité Mixte de Recherche CEA-CNRS-UVSQ (UMR 8212), IPSL, Paris-Saclay
Equipe MOSAIC : MOdelisation des SurfAces et Interfaces Continentales
Bât. 714, pièce 2115
C.E. Saclay, Orme des Merisiers, 91191 Gif-sur-Yvette Cedex, FRANCE

e-mail : pascal.maugis@lsce.ipsl.fr
Page perso : FR <http://www.lsce.ipsl.fr/Pisp/pascal.maugis/> - EN <http://www.lsce.ipsl.fr/en/Phocea/Pisp/index.php?nom=pascal.maugis>
Tel./Fax : +33 1 69 08 75 24 / +33 1 69 08 77 16

------------------------------------------------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]