*** empty log message ***

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@1043 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2001-03-04 18:30:13 +00:00
commit a62a269464
2 changed files with 70 additions and 5 deletions

65
Tools/WAD/Test/death.py Normal file
View file

@ -0,0 +1,65 @@
import debug
from Tkinter import *
def death_by_segmentation():
debug.seg_crash()
def death_by_bus():
debug.bus_crash()
def death_by_abort():
debug.abort_crash(-1)
def death_by_math():
debug.math_crash(37,0)
def death_by_buffer():
debug.overflow_crash()
def death(f):
ty = f.tvar.get()
if ty == 1:
death_by_segmentation()
elif ty == 2:
death_by_abort()
elif ty == 3:
death_by_math()
elif ty == 4:
death_by_bus()
elif ty == 5:
death_by_buffer()
class death_options(Frame):
def __init__(self):
Frame.__init__(self)
tvar = IntVar()
Radiobutton(self,text="Segmentation fault", variable=tvar, value=1).pack(anchor=W)
Radiobutton(self,text="Failed assertion", variable=tvar, value=2).pack(anchor=W)
Radiobutton(self,text="Math error", variable=tvar, value=3).pack(anchor=W)
Radiobutton(self,text="Bus error", variable=tvar, value=4).pack(anchor=W)
Radiobutton(self,text="Stack overflow", variable=tvar, value=5).pack(anchor=W)
Button(self,text="Die", command=lambda x=self: death(x)).pack(expand=1, fill=BOTH)
self.tvar = tvar
tvar.set(1)
def death_wizard():
root = Tk()
l = Label(text="How would you like to die today?")
l.pack()
death_options().pack()
root.title("Death Wizard")
death_wizard()
#root.mainloop()

View file

@ -12,6 +12,8 @@
typedef double Real;
typedef Real Float;
char buffer[256];
/* A simple segmentation fault on an uninitialized pointer */
int seg_crash() {
int *a = 0;
@ -40,12 +42,10 @@ int overflow_crash() {
}
}
/* A simple bus error. This might fail silently on certain platforms */
/* A simple bus error. */
int bus_crash() {
int b;
int *a = &b;
a = (int *) ((int) a | 0x1);
*a = 3;
double *a = (double *) (buffer+1);
*a = 3.4;
return 1;
}