Page 1 of 1

Debugging issues with C/C++

Posted: Thu Oct 31, 2019 10:29 am
by l.cedric
Hello,
after trying a lot of suffs from VMS-IDE, the last one i tried is the Debugger.
  1. I've succeeded in a simple (C) case, but not at my first try : After reading carrefully this post "Debugging issues with Fortran", because the symptoms are similar to my C/C++ code, i found the reason and a workaround (VMS-IDE bug ?)
  2. But not for a more complicated one (which is one of our production code), still an issue :
    • The debugger starts at the wrong line, and this for each steps until the end :-(
    • But nevertheless the code seems to be executed according to the debug console
Details about these tries :
  1. The simple one :
    • As you can see below in the 1st screenshoot, it successfully runs our com file, which compiles and links the code into the exe and debug files, and the command file copies those to the correct directory (mantis.build.DEBUGsansMMS, the last part must be the same as the label)
      simpleOutputRunKO&OK.png
    • This all seems to work correctly. I go to run the debugger :
      • Remark : it comes up with warnings that the .LIS file doesn't find for other source files
        • It seems to be normal for our current settings as few executables are in this same project (due to our old folder organisation), and VMS-IDE search a .LIS with each "source" (in project settings) file it finds.
        • I'll search later if it's possible, thanks to some filters's settings (or ?), to select only one executable (& its .LIS) among other. Because we usually need to debug just 1 executable, not the whole …
    • But the "annoying" issue is there :
      • As you can see above in the 2nd screeshoot, it seems to start at the end !? Nevertheless, I can step through my application until the end with good results in the debug console (but the cursor stays at the end) !?!?
      • So at its very end, this post "Debugging issues with Fortran" gave me a clue : "it didn't like my /list qualifier at the end of that include".
        • So as i didn't have this type of syntax in my C/C++ code, so i didn't pinpoint this clue right away …
          • Nevertheless, In case of, i took a look into the .LIS and … I see the whole includes expanded !!!
          • Moreover this page about the Auto-generated MMS show a very simple build option (just ~ /deb/noop/), which was not my case, due to our old production compilation options, I also simplified by this one "/SHOW=(BRIEF,INCLUDE)" (at least) which breaks the VMS-IDE debugger
        • If you remove this from the compilation everythings rocks ! The proof after few steps in the 3rd screenshoot above :-)
  2. Now the more complicated one … (still C langage) :-(
    • Now as I have the basis to work with the debugger, I try one of our production code (executable) with, of course, the help of our MMS to deal with the few OBJ and complicated build options needed.
    • So without these few other compilation options (i just managed to remove the previous /SHOW … which is at least one which breaks VMS-IDE), I can't build our current production code !
    • The result in brief which is not exactly like the previous one :
      • It starts not at the end, but at the wrong line ! :-(
      • Nevertheless, I can step through my application until the end with good results in the debug console and the cursor moves fowards (but always at the wrong line) but it is very tricky to follow the code … :?
    complicatedOutputRunKO.png

    Here's the whole output's options used (because above it is truncated) :
    outputFull.png
    As i didn't find how to attach a zip file in this post, if needed please mail me to get the full lists.zip, nevertheless here's an extract of the main .LIS file and the whole .MAP (noticed the FF escape sequence i have to add to mimic the real file ... I don't know if it could be an issue for VMS-IDE ?)

    Code: Select all

    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 1
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	      1 // ============================================================================
    	      2 //
    	      3 //  LOT:  BIP
    	      4 //
    	      5 //  DESCRIPTION DU PROGRAMME:
    	      6 //
    	      7 //      Ce programme traite de manière asynchrone les anomalies gérées par 
    	      8 //      PSF et devant donner lieu à un appel BIP.
    	      9 //	Il est connecté a un serveur NS4400, lui même relie a un PABX qui
    	     10 //      envoi les messages aux telephone portables.
    	     11 //
    	     12 //  DETAILS TECHNIQUES:
    	     13 //
    	     14 //      Un appel BIP peut provenir :
    	     15 //         - soit d'un process externe, auquel cas les anomalies sont écrites
    	     16 //	dans une mailbox par le process détecteur et on utilise les procédu-
    	     17 //	res de communications habituelles entre deux process pour récupérer 
    	     18 //	les informations.
    	     19 //         - soit d'un process externe, qui ecrit ses anomalies dans le ficher
    	     20 //      FALERTE.DAT.
    	     21 //         - soit d'une anomalie générée automatiquement par BIP_TRAITE_ANO
    	     22 //	(cas des anomalies à rappel automatique ou différés).
    	     23 //	Une table contient toutes les anos recues (ctable_ano), une file 
    	     24 //      contient la liste des anos à traiter (dans l'ordre d'apparition) et une
    	     25 //      autre la liste des appels BIP à générer (destinataire, type du 
    	     26 //	destinataire, message à envoyer).
    	     27 //	L'algorithme de traitement est un automate d'etat fini où les états
    	     28 //	représentent des états d'attentes et les évènements sont des évènements
    	     29 //	"REVEIL" (on considère que l'état stable du process est l'hibernation).
    	     30 //
    	     31 // ============================================================================
    	     32 //  PARAMETRES:
    	     33 //
    	     34 //      Nombre de tentative maximum apres lequel on passe a l'anomalie 
    	     35 //      suivante (apres detection d'un probleme de transmission)
    	     36 //
    	     37 // FICHIERS UTILISES:
    	     38 //
    	     39 //  FICHIERS                                       *  MODE D'ACCES *
    	     40 //  FBIP_ANO                                       *      GET      *
    	     41 //  FBIP_DEST                                      *      GET      *
    	     42 //  FALERTE					   *      GET      *
    	     43 //
    	     44 //  EFFETS DE BORD:
    	     45 //
    	     46 //      {@description or none@}
    	     47 //
    	     48 //  PRECONDITIONS:
    	     49 //
    	     50 //      Le process BIP_TRAITE_ANO doit être décrit dans le fichier des applis.
    	     51 //
    	     52 //  POSTCONDITIONS:
    	     53 //
    	     54 //
    	     55 //  CODES RETOURNES:
    	     56 //
    	     57 //
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 2
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	     58 // ============================================================================
    	     59 //  OPTIONS DE COMPILATION:
    	     60 //
    	     61 //      {@tbs@}
    	     62 //
    	     63 //  MOTS CLEFS:
    	     64 //
    	     65 //      [@identifier@]...
    	     66 //
    	     67 // ============================================================================
    	     68 // HISTORIQUE DES MODIFICATIONS:
    	     69 //
    	     70 // AUTEURS	    |   DATE     | DESCRIPTION
    	     71 // -----------------+------------+---------------------------------------------
    	     72 // Sandrine	    | 28/11/1994 | Création
    	     73 // -----------------+------------+---------------------------------------------
    	     74 // Laurent	    | 11/06/1999 | Remplacement des BIPs par des telephones
    	     75 //		    |	         | portables, et creation du fichier FBIP_ALERTE
    	     76 //            	    |            | FBIP_ALERTE
    	     77 // -----------------+------------+---------------------------------------------
    	     78 // Laurent Désert   | 10/08/2004 | Ajout du nom des paramètres
    	     79 // -----------------+------------+---------------------------------------------
    	     80 //		    |		 | 
    	     81 // -----------------+------------+---------------------------------------------
    	     82 //		    |		 | 
    	     83 // -----------------+------------+---------------------------------------------
    	     84 
    	     85 
    
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 3
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	     87 // ============================================================================
    	     88 //      FICHIERS INCLUS                                                       
    	     89 // ============================================================================
    	     90 #include "includes_sys.inc"
    	  52982 #include "const.inc"
    	  54384 #include "constantes.inc"
    	  61318 #include "types.inc"
    	  65375 #include "mbx_comm_var_ext.inc"
    	  65403 extern int (*cmbx_comm_fct_trait_message_lu)(int);
    	  65404 #include <netdb.h>
    	  72073 #include <tcpip$inetdef.h>
    	  73118 #include <jpidef.h>            //  $GETJPI Item Code Definitions   
    	  73532 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 4
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73533  
    	  73534 // ============================================================================
    	  73535 //      CONSTANTES                                                            
    	  73536 // ============================================================================
    	  73537 #define XC_S_EMETTEUR_AUTO        "AUTOMATIQUE "
    	  73538 #define XC_I_LG_ANO_ASCII          4
    	  73539 #define XC_I_LG_LIBEL_ANO          20  
    	  73540 #define XC_I_LG_INFO_ANO           80
    	  73541 #define XC_I_LG_FILE_ANO           50
    	  73542 #define XC_I_LG_MESS_ERR           100
    	  73543 #define XC_I_LONG_NOM              20
    	  73544 #define XC_I_LG_FILE_DEST          50
    	  73545 #define XC_I_LG_NUMERO_TEL         10
    	  73546 #define XC_I_NB_ANO                200
    	  73547 #define XC_I_NB_DEST               5
    	  73548 #define XC_S_INDIC_PARAM          "%P"
    	  73549 #define XC_S_FBIP_ALERTE          "FBIP_ALERTE"
    	  73550 
    	  73551 #define XC_I_SEUIL_TEMPO_COURTE    10
    	  73552 #define XC_I_SEUIL_TEMPO_MOYENNE   20
    	  73553 #define XC_I_SEUIL_TEMPO_LONGUE    40
    	  73554 #define XC_S_TEMPO_MIN            "0 00:00:01"
    	  73555 #define XC_S_TEMPO_MAX_PAR_DEFAUT "0 00:00:30"
    	  73556 
    	  73557 /*
    	  73558  * Etats de l'automate
    	  73559  */
    	  73560 #define XC_I_ETAT_I                0
    	  73561 #define XC_I_ETAT_RAF              1
    	  73562 #define XC_I_ETAT_ENVOI            2
    	  73563 #define XC_I_ETAT_RECU             3
    	  73564 #define XC_I_ETAT_ATT_INTER_BIP    4
    	  73565 
    	  73566 /*
    	  73567  * Nom des timers
    	  73568  */
    	  73569 #define XC_I_TIME_OUT              101
    	  73570 #define XC_I_TIMER_TABLE           102
    	  73571 #define XC_I_TIMER_ALERTE          103
    	  73572 #define XC_I_TIMER_ERREUR          104
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 5
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73574 //###########################################################################
    	  73575 // CONSTANTES RELATIVES AU PROTOCOLE DE COMMUNICATION AVEC LA CENTRALE BIP   
    	  73576 //###########################################################################
    	  73577 
    	  73578 #define XC_C_STATUS_RETOUR_OK	  'O'
    	  73579 #define XC_C_STATUS_RETOUR_KO	  'K'
    	  73580 
    	  73581 #define XC_C_HORS_ZONE		  'C'
    	  73582 #define XC_C_PAS_DE_CAUSE	  'N'
    	  73583 #define XC_C_UTILISATEUR_INCONNU  'U'
    	  73584 #define XC_C_DEBORDEMENT	  'V'
    	  73585 
    	  73586 #define XC_S_ERR_ASSIGN     "Erreur %d lors de l'assign."
    	  73587 #define XC_S_ERR_CONNECT    "Erreur %d lors de la connection."
    	  73588 #define XC_S_ERR_LIEN       "Erreur %d lors de la creation du lien."
    	  73589 #define XC_S_ERR_OUV_FIC    "Erreur %d a l'ouverture du fichier %s."
    	  73590 #define XC_S_ERR_SETIMR     "Erreur %d lors du SETIMR (%s)."
    	  73591 #define XC_S_ERR_BINTIM     "Erreur %d lors du BINTIM (%s)."
    	  73592 #define XC_S_ERR_QIO        "Erreur %d lors du QIO (READ)."
    	  73593 #define XC_S_ERR_MESS_KO    "Le status du message recu est incorrect (KO)."
    	  73594 #define XC_S_ERR_CRC        "Le CRC du message recu est incorrect."
    	  73595 #define XC_S_ERR_TIME_OUT   "Time Out detecte."
    	  73596 
    	  73597 
    	  73598 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 6
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73600 // ============================================================================
    	  73601 //                         STRUCTURES DICTIONNAIRE                            
    	  73602 // ============================================================================
    	  73603  
    	  73604 #pragma dictionary "dico_cmn.fcomm_desc"
    	  73668 #pragma dictionary "dico_cmn.fbip_ano"
    	  73690 #pragma dictionary "dico_cmn.s_ano_por"
    	  73702 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 7
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73704 // ============================================================================
    	  73705 //                     DEFINITON DES TYPES LOCAUX                             
    	  73706 // ============================================================================
    	  73707 typedef struct {
    	  73708     int   ano; 
    	  73709     char  process_origine[X_I_MBX_COMM_LG_PROCESS];
    	  73710     int   valid;
    	  73711     char  etat_ano;
    	  73712     int   dern_date_envoi;
    	  73713     int   dern_date_recue;
    	  73714     int   dern_date_debut;
    	  73715     char  dern_emetteur[X_I_MBX_COMM_LG_PROCESS];
    	  73716     int   periode;
    	  73717     int   tempo;
    	  73718     short nb_envois;
    	  73719     short nb_envois_max;
    	  73720     tbip_param bip_param;
    	  73721                } t_table_ano;
    	  73722 
    	  73723 typedef struct {
    	  73724     int premiere_ano;
    	  73725     int derniere_ano;
    	  73726     int liste_ano[XC_I_LG_FILE_ANO];
    	  73727 	       } t_file_ano;
    	  73728 
    	  73729 typedef struct {
    	  73730     int premier_dest;
    	  73731     int dernier_dest;
    	  73732     char liste_dest[XC_I_LG_FILE_DEST][XC_I_LG_NUMERO_TEL];
    	  73733     char type[XC_I_LG_FILE_DEST];
    	  73734     char msg[XC_I_LG_FILE_DEST][X_I_LG_MSG_ECRAN];
    	  73735     char process_origine[XC_I_LG_FILE_DEST][X_I_MBX_COMM_LG_PROCESS];
    	  73736 	       } t_file_dest;
    	  73737 
    	  73738 typedef struct {
    	  73739     char frame_number[3];
    	  73740     char destination;
    	  73741     char type_appel;
    	  73742     char numero_tel[10];
    	  73743     char acquitement;
    	  73744     char message[128];
    	  73745                } t_infos;
    	  73746 
    	  73747 typedef struct {
    	  73748     char ident;
    	  73749     char type;
    	  73750     t_infos infos;
    	  73751     unsigned char crc[2];
    	  73752                } t_message_envoi;
    	  73753 
    	  73754 typedef struct {
    	  73755     char ident;
    	  73756     char type;
    	  73757     char frame_number[3];
    	  73758     char status;
    	  73759     unsigned char crc[2];
    	  73760                } t_message_retour;
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 8
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73761 
    	  73762 typedef struct {          
    	  73763     short inet_family ;
    	  73764     short inet_port ;
    	  73765     union {
    	  73766         int  adr_i;
    	  73767         char adr_c[4];
    	  73768          } adr;
    	  73769     char  blkb[8] ;
    	  73770 	       } t_socket;
    	  73771 
    	  73772 typedef struct {
    	  73773     int       longueur ;
    	  73774     t_socket *adresse ;
    	  73775 	       } t_dsc_socket;
    	  73776 
    	  73777 typedef struct {
    	  73778     int       longueur ;
    	  73779     t_socket *adresse ;
    	  73780     int      *longueur_retour;
    	  73781 	       } t_dsc_get_socket;
    	  73782  
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 9
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73784 // ============================================================================
    	  73785 //                     DEFINITON DES VARIABLES GLOBALES                       
    	  73786 // ============================================================================
    	  73787 
    	  73788 // tgt_table_fichiers_psfv ctable_psfv;
    	  73789 extern tgt_table_fic_spec      ctable_fic_spec[X_I_NB_FIC_SPEC];
    	  73790 
    	  73791 
    	  73792 static struct fcomm_desc cfcomm_desc;
    	  73793 static struct fbip_ano   cbuf_ano;
    	  73794 
    	  73795 static tbip_param        ctable_param;
    	  73796 
    	  73797 static t_table_ano       ctable_ano[XC_I_NB_ANO];
    	  73798 static t_file_ano        cfile_ano;
    	  73799 static t_file_dest       cfile_dest;
    	  73800 
    	  73801 
    	  73802 extern unsigned short    creveil_interne_psf;
    	  73803 
    	  73804 /* 
    	  73805  * Variables permettant de gérer les différents timer 
    	  73806  */
    	  73807 static double cdelai_bin_scrute_table      ,
    	  73808               cdelai_bin_scrute_alerte_min ,
    	  73809               cdelai_bin_scrute_alerte_max ,
    	  73810               cdelai_bin_time_out          ,
    	  73811               cdelai_bin_timer_erreur      ;
    	  73812 
    	  73813 static int ccpt_timer_alerte ;   
    	  73814 
    	  73815 static int cetat_automate ;
    	  73816 
    	  73817 /* 
    	  73818  * Variables boleennes refletant les différents événements pouvant 
    	  73819  * réveiller le process                                            
    	  73820  */
    	  73821 static int cevenement_sp     ,
    	  73822            cfin_timer_table  ,
    	  73823 	   cfin_timer_alerte ,
    	  73824 	   cfin_time_out     ,
    	  73825 	   cfin_timer_erreur ,
    	  73826 	   cfin_connect      ,
    	  73827 	   cerr_port         ,
    	  73828 	   cretour_serveur   ,
    	  73829            cano              ,
    	  73830            cnb_envoi         , 
    	  73831            cnb_envoi_max     ;
    	  73832 
    	  73833 /* 
    	  73834  * Variables utilisées dans les différentes QIO 
    	  73835  */
    	  73836 static short ciosb[4],
    	  73837              ciosb_lect[4];
    	  73838 
    	  73839 static short ccanal;
    	  73840     
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 10
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73841 static int ctaille_retour = 0;
    	  73842 
    	  73843 
    	  73844 static short cnb_ano_dans_table, 
    	  73845              cindex_ano;
    	  73846 static char  cetat_ano,
    	  73847              cdernier_emetteur[X_I_MBX_COMM_LG_PROCESS],
    	  73848              cprocess_origine[X_I_MBX_COMM_LG_PROCESS],
    	  73849              cmess_err[XC_I_LG_MESS_ERR];
    	  73850 static t_socket         cadr_socket_locl,
    	  73851                         cadr_socket_dist;
    	  73852 static t_dsc_socket     cdsc_socket_dist;
    	  73853 static t_dsc_get_socket cdsc_get_socket_dist;
    	  73854 
    	  73855 /*
    	  73856  *    Variables communes propres à la programmation du protocole de comm.     
    	  73857  */
    	  73858 static t_message_envoi  cmessage_envoi;
    	  73859 static t_message_retour cmessage_recu;
    	  73860 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 11
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73862 /*
    	  73863  * Prototypes des fonctions EXTERNES 
    	  73864  */
    	  73865 
    	  73866 extern int   ENTIER_ASCII  (
    	  73867        int   lentier, 
    	  73868        char *lchaine, 
    	  73869        int   lg_chaine, 
    	  73870        int   lsup_zero   );
    	  73871 
    	  73872 
    	  73873 extern int DUMP(
    	  73874         char *lstr, 
    	  73875         short lg);
    	  73876 
    	  73877 extern int OUVERTURE_FJDB_MSG  (
    	  73878          );
    	  73879 
    	  73880 extern int OUVERTURE_FXXX_FLUX (
    	  73881        char  *lnom_fichier, 
    	  73882        short *lind_fic  );
    	  73883 
    	  73884 extern int ACCES_FXXX_FLUX (
    	  73885        char        *lnom_fichier,
    	  73886        int          lmode_acces,
    	  73887        tgf_iaf_rel *lpiaf,
    	  73888        short       *lind_fic,
    	  73889        short        lind_lect  );
    	  73890 
    	  73891 extern int ACCES_FBIP_ANO  (
    	  73892        int      lmode_acces,
    	  73893        tgf_iaf *lpiaf   );
    	  73894 
    	  73895 extern int  ACCES_FCOMM_DESC (
    	  73896        int      lmode_acces, 
    	  73897        tgf_iaf *lpiaf  );
    	  73898 
    	  73899 extern int ACCES_FAPPLI_DESC ( 
    	  73900        int      lmode_acces, 
    	  73901        tgf_iaf *lpiaf);
    	  73902 
    	  73903 extern ATOI_LG  (
    	  73904        char *lbuffer,
    	  73905        short longueur  );
    	  73906 
    	  73907 extern EXTRACT_NOM_PROGRAMME  (
    	  73908        char lprgm[81]  );
    	  73909 
    	  73910 extern int OUVERTURE_FBIP_ANO  (
    	  73911          );
    	  73912 
    	  73913 extern int OUVERTURE_FBIP_DEST  (
    	  73914          );
    	  73915 
    	  73916 extern int  OUVERTURE_FCOMM_DESC (
    	  73917        int va_alist );
    	  73918 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 12
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73919 static void  lect_fcomm_desc(
    	  73920           );
    	  73921 
    	  73922 extern int TRACE ( 
    	  73923        char ,
    	  73924        char *,
    	  73925        ... );
    	  73926 
    	  73927 extern int TRACE_LOG (
    	  73928         char *lformat, 
    	  73929         ...    );
    	  73930 
    	  73931 extern DUMP_LOG (
    	  73932        char *ltext,
    	  73933        char *lstr,
    	  73934        short lg    );
    	  73935 
    	  73936 extern MBX_COMM_CREATION_MBX(
    	  73937 	int lindex, 
    	  73938 	int ldelai_attente, 
    	  73939 	int lnb_message);
    	  73940 
    	  73941 extern MBX_COMM_TEST_ARRET(
    	  73942 	int lindex_max, 
    	  73943 	int laction);
    	  73944 
    	  73945 extern int JDB_ENVOI_MSG(
    	  73946         char *lfonc, 
    	  73947         char lsev);
    	  73948 
    	  73949 extern int JDB_INIT(
    	  73950         int lnum_msg, 
    	  73951         int lnum);
    	  73952 
    	  73953 extern void JDB_PARAM(
    	  73954         char ltype, 
    	  73955         void *ldonnees);
    	  73956 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 13
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  73958 /*
    	  73959  * Prototypes des fonctions INTERNES 
    	  73960  */
    	  73961 
    	  73962 static void affiche_envoi              ( char *lenvoi  );
    	  73963 static void affiche_reponse            ( void  );
    	  73964 static void arme_time_out              ( void   );
    	  73965 static void arme_timer_alerte          ( void   );
    	  73966 static void arme_timer_table           ( void   );
    	  73967 static void arme_timer_erreur          ( void   );
    	  73968 static void arrivee_ano                ( void   );
    	  73969 static int  assign_port                ( void   );
    	  73970 static void ast_force_cevenement_sp    ( void   );
    	  73971 static void ast_read_ns4400            ( void   );
    	  73972 static void calcul_crc                 ( unsigned char *lp_message_envoi   );
    	  73973 static void casse_tout                 ( void   );
    	  73974 static void envoi_message              ( void   );
    	  73975 static void ecoute_port                ( void );
    	  73976 static void ecrit_message              ( void   );
    	  73977 static void formatte_msg_pour_bip      ( char *lmessage ,
    	  73978                                          char *lmessage_bip  );
    	  73979 static int  incremente                 ( int lindex  );
    	  73980 static void info_parametre             ( void  );
    	  73981 static void initialisation             ( void   );
    	  73982 static void liberation_port            ( void   );
    	  73983 static void maj_file_ano_apres_recept  ( void   );
    	  73984 static void maj_file_ano_apres_trait   ( int  lano  );
    	  73985 static void maj_file_dest_apres_trait  ( char *ldest,
    	  73986                                          char  ltype,
    	  73987                                          char *lmess,
    	  73988                                          char *lprocess  );
    	  73989 static void maj_file_dest_apres_envoi  ( void    );
    	  73990 static void maj_table_ano_apres_envoi  ( int  lnum_ano  );
    	  73991 static void maj_table_ano_apres_recept ( void );
    	  73992 static void maj_table_ano_apres_trait  ( int  lnum_ano  );
    	  73993 static int mbx_comm_trait_message_lu (int lnum_mbx);
    	  73994 static void mise_en_attente            ( void   );
    	  73995 static void recherche_index_ano        ( void   );
    	  73996 static void recherche_index_valid      ( void   );
    	  73997 static int  recherche_validite_ano     ( int  lnum_ano  );
    	  73998 static int  recherche_validite_bip     ( char *lbip  );
    	  73999 static int  recup_param                ( short lnb_arg , char *largv[] );
    	  74000 static void recup_scrute_alerte_max    ( char *lch_lparam  );
    	  74001 static void scrutation_table_ano       ( void   );
    	  74002 static void scrutation_falerte         ( void   );
    	  74003 static void traite_anomalie            ( void   );
    	  74004 static void traitement_message_recu    ( void   );
    	  74005 static int  verif_crc                  ( void   );
    	  74006 
    FF
    PSF_BIP_SERV                    Source Listing                  31-OCT-2019 14:55:46  HP C V7.3-018-50H5P               Page 14
    V1.0                                                            17-JUL-2019 15:47:02  psf_bip_serv.c;4
    
    	  74008 // ============================================================================
    	  74009 // Debut du programme PSF_BIP_SERV
    	  74010 // ============================================================================
    	  74011 main(int largc, char *largv[])
          1	  74012 {
          1	  74013 int lstatus;
          1	  74014 
          1	  74015 cmbx_comm_fct_trait_message_lu = mbx_comm_trait_message_lu;
          1	  74016 TRACE_LOG ("Debut de PSF_BIP_SERV");
          1	  74017 lstatus = recup_param( largc , largv );
          1	  74018 if ( lstatus != X_I_ACCES_OK)
          2	  74019   {
          2	  74020    exit(SS$_BADPARAM);
          1	  74021   }
          1	  74022 
          1	  74023 X_S_JDB_CHARGE_NOM_PROGRAMME;
          1	  74024 initialisation();
          1	  74025 
          1	  74026 for (;lstatus = MBX_COMM_TEST_ARRET(0,X_I_MBX_COMM_HIBERN);)
          2	  74027   {
          2	  74028    TRACE (2, "etat_alerte = %c", cmbx_comm_etat_proc);
          2	  74029    if ( cevenement_sp != 0)
          3	  74030      { 
          3	  74031       arrivee_ano();
          2	  74032      }
          2	  74033 
          2	  74034    if (cfin_timer_alerte != 0)
          3	  74035      {
          3	  74036       scrutation_falerte();
          3	  74037       arme_timer_alerte();
          2	  74038      }
          2	  74039 
          2	  74040    if (cfin_timer_table != 0)
          3	  74041      {
          3	  74042       if( cmbx_comm_etat_proc == X_C_ETAT_PROC_SANS_ALERTE)
          4	  74043         {
    

    Code: Select all

    FF
    EXE:PSF_BIP_SERV.EXE                                            31-OCT-2019 14:55        Linker I02-38                    Page    1
    
                                               +---------------------------+
                                               ! Object and Image Synopsis !
                                               +---------------------------+
    
    Module/Image     File           Ident              Attributes          Bytes  Creation Date      Creator
    ------------     ----           -----           ----------------       -----  -------------      -------
    PSF_SCAT_COMMON_TOOLS           ETUDES              Lkg                   0  25-OCT-2019 20:48  Linker I02-38
                     DISK$USER:[EXPLOIT.EXE]PSF_SCAT_COMMON_TOOLS.EXE;41
    ACCES_FBIP_ANO                  V1.0                Lkg     VXfl      13474  31-OCT-2019 14:55  HP C V7.3-018
                     DISK$GIT:[users.cedric_git.mantis.build.debug]ACCES_FBIP_ANO.OBJ;3
    OUVERTURE_FBIP_ANO              V1.0                Lkg     VXfl       2660  31-OCT-2019 14:55  HP C V7.3-018
                     DISK$GIT:[users.cedric_git.mantis.build.debug]OUVERTURE_FBIP_ANO.OBJ;3
    OUVERTURE_FBIP_DEST             V1.0                Lkg     VXfl       2660  31-OCT-2019 14:55  HP C V7.3-018
                     DISK$GIT:[users.cedric_git.mantis.build.debug]OUVERTURE_FBIP_DEST.OBJ;3
    PSF_BIP_SERV                    V1.0                Lkg     VXfl     245419  31-OCT-2019 14:55  HP C V7.3-018
                     DISK$GIT:[users.cedric_git.mantis.build.debug]PSF_BIP_SERV.OBJ;3
    DECC$SHR                        V8.4-00             Lkg                   0  10-FEB-2014 13:26  Linker I02-37
                     SYS$COMMON:[SYSLIB]DECC$SHR.EXE;1
    FDLSHR                          X-23                Lkg                   0  30-MAR-2010 19:43  Linker I02-37
                     SYS$COMMON:[SYSLIB]FDLSHR.EXE;1
    LIBRTL                          X01-001             Lkg                   0  22-FEB-2013 13:10  Linker I02-37
                     SYS$COMMON:[SYSLIB]LIBRTL.EXE;1
    LIBOTS                          V1.0-1              Lkg                   0   6-FEB-2015 14:36  Linker I02-37
                     SYS$COMMON:[SYSLIB]LIBOTS.EXE;1
    SYS$PUBLIC_VECTORS              X-3             Sel Lkg                   0  30-MAR-2010 19:41  Linker I02-37
                     SYS$COMMON:[SYSLIB]SYS$PUBLIC_VECTORS.EXE;1
    
    
    		 Key for Attributes
    		+------------------------------------------+
    		! Sel  - Module was selectively searched   !
    		! Lkg  - Contains call linkage information !
    		! VXfl - VAX Float FP model                !
    		+------------------------------------------+
    
                                                +--------------------------+
                                                ! Program Section Synopsis !
                                                +--------------------------+
    
    Psect Name      Module/Image      Base     End           Length            Align                 Attributes
    ----------      ------------      ----     ---           ------            -----                 ----------
    $BSS$                           00010000 0003C5CF 0002C5D0 (     181712.) OCTA  4 CON,REL,LCL,NOSHR,NOEXE,  WRT,NOVEC,NOMOD  
                    PSF_BIP_SERV    00010000 0003C5CF 0002C5D0 (     181712.) OCTA  4  
    $CODE$                          00040000 0005198F 00011990 (      72080.) OCTA  4 CON,REL,LCL,  SHR,  EXE,NOWRT,NOVEC,  MOD  
                    ACCES_FBIP_ANO  00040000 0004311F 00003120 (      12576.) OCTA  4  
                    OUVERTURE_FBIP_ANO                     
                                    00043120 00043A7F 00000960 (       2400.) OCTA  4  
                    OUVERTURE_FBIP_DEST                    
                                    00043A80 000443DF 00000960 (       2400.) OCTA  4  
                    PSF_BIP_SERV    000443E0 0005198F 0000D5B0 (      54704.) OCTA  4  
    $LINKER C$0                     00051990 0005212F 000007A0 (       1952.) OCTA  4 CON,REL,LCL,  SHR,  EXE,NOWRT,NOVEC,  MOD  
                    <Linker>        00051990 0005212F 000007A0 (       1952.) OCTA  4  
    $LINK$                          00060000 00060027 00000028 (         40.) OCTA  4 CON,REL,LCL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD  
                    PSF_BIP_SERV    00060000 00060027 00000028 (         40.) OCTA  4  
    $LITERAL$                       00060030 0006167A 0000164B (       5707.) OCTA  4 CON,REL,LCL,  SHR,NOEXE,NOWRT,NOVEC,  MOD  
    FF
    DISK$GIT:[users.cedric_git.mantis.build.debug]PSF_BIP_SERV.EXE  31-OCT-2019 14:55        Linker I02-38                    Page    2
    
    
    Psect Name      Module/Image      Base     End           Length            Align                 Attributes
    ----------      ------------      ----     ---           ------            -----                 ----------
    $LITERAL$                       00060030 0006167A 0000164B (       5707.) OCTA  4 CON,REL,LCL,  SHR,NOEXE,NOWRT,NOVEC,  MOD         
                    ACCES_FBIP_ANO  00060030 00060131 00000102 (        258.) OCTA  4  
                    OUVERTURE_FBIP_ANO                     
                                    00060140 00060183 00000044 (         68.) OCTA  4  
                    OUVERTURE_FBIP_DEST                    
                                    00060190 000601D3 00000044 (         68.) OCTA  4  
                    PSF_BIP_SERV    000601E0 0006167A 0000149B (       5275.) OCTA  4  
    $READONLY$                      00061680 00061B5F 000004E0 (       1248.) OCTA  4 CON,REL,LCL,  SHR,NOEXE,NOWRT,NOVEC,  MOD  
                    ACCES_FBIP_ANO  00061680 0006171F 000000A0 (        160.) OCTA  4  
                    OUVERTURE_FBIP_ANO                     
                                    00061720 00061747 00000028 (         40.) OCTA  4  
                    OUVERTURE_FBIP_DEST                    
                                    00061750 00061777 00000028 (         40.) OCTA  4  
                    PSF_BIP_SERV    00061780 00061B5F 000003E0 (        992.) OCTA  4  
    $LINKER UNWIND$                 00070000 0007053F 00000540 (       1344.) QUAD  3 CON,REL,LCL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD  
                    ACCES_FBIP_ANO  00070000 000700A7 000000A8 (        168.) QUAD  3  
                    OUVERTURE_FBIP_ANO                     
                                    000700A8 000700BF 00000018 (         24.) QUAD  3  
                    OUVERTURE_FBIP_DEST                    
                                    000700C0 000700D7 00000018 (         24.) QUAD  3  
                    PSF_BIP_SERV    000700D8 0007053F 00000468 (       1128.) QUAD  3  
    $LINKER UNWINFO$                00070540 00070B77 00000638 (       1592.) QUAD  3 CON,REL,LCL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD  
                    ACCES_FBIP_ANO  00070540 0007061F 000000E0 (        224.) QUAD  3  
                    OUVERTURE_FBIP_ANO                     
                                    00070620 00070647 00000028 (         40.) QUAD  3  
                    OUVERTURE_FBIP_DEST                    
                                    00070648 0007066F 00000028 (         40.) QUAD  3  
                    PSF_BIP_SERV    00070670 00070B77 00000508 (       1288.) QUAD  3  
    .sbss                           00080000 0008009B 0000009C (        156.) OCTA  4 CON,REL,GBL,NOSHR,NOEXE,  WRT,NOVEC,NOMOD,SHORT 
                    PSF_BIP_SERV    00080000 0008009B 0000009C (        156.) OCTA  4  
    .sdata                          000800A0 0008023B 0000019C (        412.) OCTA  4 CON,REL,GBL,NOSHR,NOEXE,  WRT,NOVEC,  MOD,SHORT 
                    ACCES_FBIP_ANO  000800A0 000800F7 00000058 (         88.) OCTA  4  
                    OUVERTURE_FBIP_ANO                     
                                    00080100 00080157 00000058 (         88.) OCTA  4  
                    OUVERTURE_FBIP_DEST                    
                                    00080160 000801B7 00000058 (         88.) OCTA  4  
                    PSF_BIP_SERV    000801C0 0008023B 0000007C (        124.) OCTA  4  
    $LINKER SDATA$                  00090000 00090CA7 00000CA8 (       3240.) OCTA  4 CON,REL,GBL,NOSHR,NOEXE,NOWRT,NOVEC,  MOD,SHORT 
                    <Linker>        00090000 00090CA7 00000CA8 (       3240.) OCTA  4  
    
                                                    +-----------------+
                                                    ! Symbols By Name !
                                                    +-----------------+
    
    Symbol                          Value                                                   Symbol                          Value     
    ------                          -----                                                   ------                          -----       
    ACCES_FBIP_ANO                  00040000-RC                                             CMBX_COMM_FCT_TRAIT_MESSAGE_LU  00000048-X  
    ACCES_FCOMM_DESC                00000002-X                                              CMBX_COMM_TRACE                 0000004A-X  
    ACCES_FXXX_FLUX                 0000000C-X                                              CMBX_POSTE                      0000004B-X  
    ATOI_LG                         00000018-X                                              CREVEIL_INTERNE_PSF             0000006F-X  
    CMBX_COMM_AST_A_BLOQUER         00000041-X                                              CTABLE                          00000070-X  
    CMBX_COMM_ETAT_PROC             00000047-X                                              CTABLE_FIC_SPEC                 00000078-X  
    FF
    DISK$GIT:[users.cedric_git.mantis.build.debug]PSF_BIP_SERV.EXE  31-OCT-2019 14:55        Linker I02-38                    Page    3
    
    
    Symbol                          Value                                                   Symbol                          Value     
    ------                          -----                                                   ------                          -----       
    DUMP_LOG                        00000108-X                                              
    ELF$TFRADR                      00090C60-R                                              
    ENTIER_ASCII                    0000010A-X                                              
    EXTRACT_NOM_PROGRAMME           00000112-X                                              
    FBIP_ANO_CREATION               00041EF0-RC                                             
    FBIP_ANO_LECTURE_SUIV           000417D0-RC                                             
    FBIP_ANO_LECT_DIR               00040F00-RC                                             
    FBIP_ANO_MODIF                  00042750-RC                                             
    FBIP_ANO_POSITION               00040810-RC                                             
    FBIP_ANO_PURGE                  00042D50-RC                                             
    JDB_ENVOI_MSG                   0000012F-X                                              
    JDB_INIT                        00000133-X                                              
    JDB_PARAM                       00000134-X                                              
    MAIN                            00044530-RC                                             
    MBX_COMM_CREATION_MBX           0000014E-X                                              
    MBX_COMM_TEST_ARRET             00000155-X                                              
    OUVERTURE_FBIP_ANO              00043120-RC                                             
    OUVERTURE_FBIP_DEST             00043A80-RC                                             
    OUVERTURE_FCOMM_DESC            00000177-X                                              
    OUVERTURE_FJDB_MSG              0000017D-X                                              
    OUVERTURE_FXXX_FLUX             00000182-X                                              
    TRACE                           0000021F-X                                              
    TRACE_LOG                       00000227-X                                              
    __MAIN                          000443E0-RC                                             
    
    
                  Key for special characters above
    		+----------------------+
    		!   *  - Undefined     !
    		!  (U) - Universal     !
    		!   R  - Relocatable   !
    		!   X  - External      !
    		!   C  - Code Address  !
    		!  WK  - Weak          !
    		! UxWk - Unix-Weak     !
    		+----------------------+
    FF
    DISK$GIT:[users.cedric_git.mantis.build.debug]PSF_BIP_SERV.EXE  31-OCT-2019 14:55        Linker I02-38                    Page    4
    
                                                     +----------------+
                                                     ! Image Synopsis !
                                                     +----------------+
    
    Virtual memory allocated:                         00010000 0009FFFF 00090000 (589824. bytes, 1152. pages)
    64-Bit Virtual memory allocated:                  00000000 00000000 00000000
                                                      80000000 80010000 00010000 (65536. bytes, 128. pages)
    Stack size:                                             20. pages
    Image header virtual block limits:                       1.        1. (    1. block)
    Image binary virtual block limits:                       2.      201. (  200. blocks)
    Image name and identification:                    PSF_BIP_SERV ETUDES (FABCED)
    Number of files:                                        13.
    Number of modules:                                      10.
    Number of program sections:                             16.
    Number of global symbols:                             4655.
    Number of image segments:                                7.
    Transfer address from module:                 PSF_BIP_SERV
    User transfer FD address:                00000000 00090C60
    User transfer code address:              00000000 000443E0
    Initial FP mode:                         00000000 0980000E (VAX FLOAT)
    Number of code references to shareable images:          71.
    Image type:                                       EXECUTABLE.
    Reduced Floating Point model (RFP):               Image does not use RFP model
    Map format:                                       DEFAULT in file DISK$GIT:[users.cedric_git.mantis.build.debug]PSF_BIP_SERV.MAP;3
    Estimated map length:                             315. blocks
    
                                                  +---------------------+
                                                  ! Link Run Statistics !
                                                  +---------------------+
    
    Performance Indicators                            Page Faults	CPU Time	Elapsed Time
    ----------------------                            -----------	--------	------------
        Command processing:                                    44	00:00:00.00	00:00:00.01
        Pass 1:                                               262	00:00:00.01	00:00:00.02
        Allocation/Relocation:                                 13	00:00:00.00	00:00:00.00
        Pass 2:                                               590	00:00:00.00	00:00:00.00
        Write program segments:                                11	00:00:00.00	00:00:00.00
        Symbol table output:                                    7	00:00:00.00	00:00:00.00
        Map data after object module synopsis:                  5	00:00:00.00	00:00:00.00
    Total run values:                                         932	00:00:00.01	00:00:00.05
    
    Quota usage                                        ByteCount  FileCount  PgFlCount
    ------------                                       ---------  ---------  ---------
        Available:                                         99840        400     512000
        Command processing:                                 1152         10      25088
        Pass 1:                                             1152         10      28352
        Allocation/Relocation:                              1344         11      28544
        Pass 2:                                              576          7      37552
        Write program segments:                              768          8      37680
        Symbol table output:                                 576          7      37680
        Map data after object module synopsis:               576          7      37680
    
    Using a working set limited to 32768 pages and 12053 pages of data storage (excluding image)
    
    Number of modules extracted explicitly             = 0
    FF
    DISK$GIT:[users.cedric_git.mantis.build.debug]PSF_BIP_SERV.EXE  31-OCT-2019 14:55        Linker I02-38                    Page    5
    
        with 0 extracted to resolve undefined symbols
    
    68 library searches were for symbols not in the library searched
    
    A total of 12 global symbol table entries was written
    
    LINK/DEBUG/MAP=EXE:PSF_BIP_SERV.MAP SOURCE:PSF_BIP_SERV.OBJECT_LIST/OPT,SOURCE:VERSION.OP/OPT/EXE=EXE:PSF_BIP_SERV.EXE
    
  3. Remark : i've also tried with a C++ one, and ~ the same type of issue :-(
Anyone have any ideas on what to do ? Thanks for any help !

Re: Debugging issues with C/C++

Posted: Mon Nov 04, 2019 11:22 am
by l.cedric
I answered to myself, because after few others tries I've just found the root cause :
  • In the previous post I've noticed few FF escape sequence in the .LIS ... but in fact they came from our source files :shock: !!! Indeed, our old code (~25 years old) is full of these stuff due to some VMS old editors ... not as friendly as VSCode, and so helped us to navigate quickly in the source files.
    sourceFF.png
    sourceFF.png (8.57 KiB) Viewed 4992 times
    (not displayed by default in VScode)
  • When i count them ... 9 FF ... before the main function ... which is exactly the number of shifted lines in debugger execution ! :idea: So i remove them to my source file to test et Voila !
    DebuggerSansFF.png

So to summarize the whole thing :
  1. The simple one : VMS-IDE debugger does not yet support the compilation option /SHOW=... (see above)
  2. The more complicated one : VMS-IDE debugger does not yet support FF escape sequence in the source file
Just a little confirmation : Is it the right place to post VMS-IDE issues for the developers :?:
Thank you in advance VSI :)

Re: Debugging issues with C/C++

Posted: Tue Nov 05, 2019 12:28 am
by sergey_vorfolomeev
Thanks for a good investigation!
There is a big issue to find a right line in source by information provided by listing.
We cannot just compare each line from listing with each line in source. But, of course, we have to improve our algorithm...
PS: about ZIP - you can upload it on some cloud and put a link here.

Re: Debugging issues with C/C++

Posted: Tue Nov 05, 2019 3:16 am
by l.cedric
Thanks Sergey for the confirmation of these issues.
And if needed, here's the lists.zip :
https://1drv.ms/u/s!Am_-yrC4_SQ_jTruh_Z ... E?e=ctVz9i