add CRASHREPORT directly to browser

add CRASHREPORT for Windows
add ^P info to report (via DUMPLOG)

new options: crash_email, crash_name, crash_urlmax
new game command: #bugreport
new config option: CRASHREPORT_EXEC_NOSTDERR
new command line option: --bidshow

deleted helper scripts:
    NetHackCrashReport.Javascript
    nhcrashreport.lua

misc:
    update CRASHREPORTURL (will need to be updated before release)
    update bitrot in winchain
    winchain for Windows
    add missing synch_wait for NetHackW --showpaths
    add PANICTRACE (and CRASHREPORT) in mdlib.c:build_opts

missing:
    packaging (Windows needs the pdb file)
    no testing with MSVC command line build

port status:
    linux: working, but glibc's backtrace doesn't show static functions
    Windows VS: working.  pdb file is large - looking into options
    MacOS: working
    msdos: not supported
    VMS: not supported
    MSVC: planned, but not attempted
    MSYS2: working, but libbacktrace not showing symbols (yet?)
This commit is contained in:
nhkeni
2024-02-06 18:33:59 -05:00
parent cf3cbcf832
commit dbe5c98dca
37 changed files with 1001 additions and 315 deletions

View File

@@ -241,12 +241,33 @@
#ifndef CRASHREPORT
# ifdef MACOS
/* NB: This needs to be a full path unless it's in the playground. */
//#define CRASHREPORT "NetHackCrashReport.JavaScript"
# define CRASHREPORT "/usr/bin/open"
# endif
# ifdef __linux__
/* NB: This expects to find the nhlua binary as "./nhlua" */
//#define CRASHREPORT "nhcrashreport.lua"
# define CRASHREPORT "/usr/bin/xdg-open"
/* Define this if the terminal is filled with useless error messages
* when the browser launches. */
# define CRASHREPORT_EXEC_NOSTDERR
# endif
# ifdef WIN32
# define CRASHREPORT /* builtin helper */
# endif
#endif
#ifdef CRASHREPORT
# ifndef DUMPLOG
# define DUMPLOG // required to get ^P info
# endif
# ifdef MACOS
# define PANICTRACE
# endif
# ifdef __linux__
# define PANICTRACE
# endif
// This test isn't quite right: CNG is only available from Windows 2000 on.
// But we'll check that at runtime.
# ifdef WIN32
# define PANICTRACE
# endif
#endif

View File

@@ -235,6 +235,11 @@ struct instance_globals_c {
/* dog.c */
char catname[PL_PSIZ];
/* end.c */
char *crash_email; // email for crash reports
char *crash_name; // human name for crash reports
int crash_urlmax; // maximum length for the url of a crash report
/* symbols.c */
int currentgraphics;

View File

@@ -819,10 +819,12 @@ extern struct kinfo *find_delayed_killer(int);
extern void dealloc_killer(struct kinfo *);
extern void save_killers(NHFILE *);
extern void restore_killers(NHFILE *);
#ifdef CRASHREPORT
extern boolean submit_web_report(const char *, char *);
#if defined(CRASHREPORT)
extern boolean submit_web_report(int, const char *, const char *);
extern void crashreport_init(int, char *[]);
extern void crashreport_bidshow(void);
extern boolean swr_add_uricoded(const char *, char **, int *, char *);
extern int dobugreport(void);
#endif
extern char *build_english_list(char *);
#if defined(PANICTRACE) && !defined(NO_SIGNAL)
@@ -1804,6 +1806,13 @@ extern int dosuspend(void);
extern void nt_regularize(char *);
extern int(*nt_kbhit)(void);
extern void Delay(int);
# ifdef CRASHREPORT
struct CRctxt;
extern struct CRctxt *ctxp;
extern int win32_cr_helper(char, struct CRctxt *, void *, int);
extern int win32_cr_gettrace(int, char *, int);
extern int *win32_cr_shellexecute(const char *);
# endif
#endif /* WIN32 */
#endif /* MICRO || WIN32 */
@@ -2661,7 +2670,7 @@ extern char *get_sound_effect_filename(int32_t seidint,
char *buf, size_t bufsz, int32_t);
#endif
extern char *base_soundname_to_filename(char *, char *, size_t, int32_t);
extern void set_voice(struct monst *, int32_t, int32_t, int32_t);
extern void set_voice(struct monst *, int32_t, int32_t, int32_t);
extern void sound_speak(const char *);
/* ### sp_lev.c ### */

View File

@@ -418,7 +418,7 @@ enum earlyarg {
#ifdef WIN32
, ARG_WINDOWS
#endif
#ifdef CRASHREPORT
#if defined(CRASHREPORT)
, ARG_BIDSHOW
#endif
};

View File

@@ -226,6 +226,17 @@ static int optfn_##a(int, int, boolean, char *, char *);
NHOPTB(confirm, Advanced, 0, opt_out, set_in_game,
On, Yes, No, No, NoAlias, &flags.confirm, Term_False,
"ask before hitting tame or peaceful monsters")
#ifdef CRASHREPORT
NHOPTC(crash_email, Advanced, PL_NSIZ, opt_in, set_in_game,
No, Yes, No, No, NoAlias,
"email address for reporting")
NHOPTC(crash_name, Advanced, PL_NSIZ, opt_in, set_in_game,
No, Yes, No, No, NoAlias,
"your name for reporting")
NHOPTC(crash_urlmax, Advanced, PL_NSIZ, opt_in, set_in_game,
No, Yes, No, No, NoAlias,
"length of longest url we can generate")
#endif
#ifdef CURSES_GRAPHICS
NHOPTC(cursesgraphics, Advanced, 70, opt_in, set_in_config,
No, Yes, No, No, NoAlias,

View File

@@ -101,12 +101,7 @@ extern char *windows_exepath(void);
*/
#ifdef __MINGW32__
#if 0
#define MD_USE_TMPFILE_S
#if !defined(__cplusplus)
extern errno_t tmpfile_s(FILE * restrict * restrict streamptr);
#endif
#endif
#
#ifdef strncasecmp
#undef strncasecmp

View File

@@ -14,8 +14,9 @@ enum wp_ids { wp_tty = 1, wp_X11, wp_Qt, wp_mswin, wp_curses,
wp_chainin, wp_chainout, wp_safestartup, wp_shim,
wp_hup, wp_guistubs, wp_ttystubs,
#ifdef OUTDATED_STUFF
, wp_mac, wp_Gem, wp_Gnome, wp_amii, wp_amiv
wp_mac, wp_Gem, wp_Gnome, wp_amii, wp_amiv,
#endif
wp_trace // XXX do we need this? should chainin/out get an id? TBD
};
/* NB: this MUST match chain_procs below */
@@ -107,6 +108,7 @@ extern
/*
* If you wish to only support one window system and not use procedure
* pointers, add the appropriate #ifdef below.
* XXX which is what?
*/
#define init_nhwindows (*windowprocs.win_init_nhwindows)
@@ -359,7 +361,6 @@ struct chain_procs {
void (*win_end_menu)(CARGS, winid, const char *);
int (*win_select_menu)(CARGS, winid, int, MENU_ITEM_P **);
char (*win_message_menu)(CARGS, char, int, const char *);
void (*win_update_inventory)(CARGS, int);
void (*win_mark_synch)(CARGS);
void (*win_wait_synch)(CARGS);
#ifdef CLIPPING
@@ -407,6 +408,8 @@ struct chain_procs {
void (*win_status_update)(CARGS, int, genericptr_t, int, int, int,
unsigned long *);
boolean (*win_can_suspend)(CARGS);
void (*win_update_inventory)(CARGS, int);
win_request_info *(*win_ctrl_nhwindow)(CARGS, winid, int, win_request_info *);
};
#endif /* WINCHAIN */