[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
segmentation violation in debug mode when watching for an index of an ar
From: |
Pascal Maugis |
Subject: |
segmentation violation in debug mode when watching for an index of an array and rerunning |
Date: |
Tue, 13 Sep 2022 13:48:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
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
------------------------------------------------------------------------