[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: |
arnold |
Subject: |
Re: segmentation violation in debug mode when watching for an index of an array and rerunning |
Date: |
Sat, 17 Sep 2022 13:19:19 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
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
>
> ------------------------------------------------------------------------