Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(37)

Delta Between Two Patch Sets: src/pkg/runtime/linux/thread.c

Issue 906041: code review 906041: runtime: turn divide by zero, nil dereference into panics (Closed)
Left Patch Set: code review 906041: runtime: turn divide by zero, nil dereference into panics Created 14 years, 12 months ago
Right Patch Set: code review 906041: runtime: turn divide by zero, nil dereference into panics Created 14 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/linux/signals.h ('k') | src/pkg/runtime/runtime.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include "runtime.h" 5 #include "runtime.h"
6 #include "defs.h" 6 #include "defs.h"
7 #include "os.h" 7 #include "os.h"
8 8
9 extern SigTab sigtab[]; 9 extern SigTab sigtab[];
10 10
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 m->gsignal = malg(32*1024); // OS X wants >=8K, Linux >=2K 271 m->gsignal = malg(32*1024); // OS X wants >=8K, Linux >=2K
272 signalstack(m->gsignal->stackguard, 32*1024); 272 signalstack(m->gsignal->stackguard, 32*1024);
273 } 273 }
274 274
275 void 275 void
276 sigpanic(void) 276 sigpanic(void)
277 { 277 {
278 switch(g->sig) { 278 switch(g->sig) {
279 case SIGBUS: 279 case SIGBUS:
280 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) 280 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000)
281 » » » goto badaddr; 281 » » » panicstring("invalid memory address or nil pointer deref erence");
r 2010/04/08 23:54:08 again
282 break; 282 break;
283 case SIGSEGV: 283 case SIGSEGV:
284 if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcod e1 < 0x1000) 284 if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR) && g->sigcod e1 < 0x1000)
285 » » » goto badaddr; 285 » » » panicstring("invalid memory address or nil pointer deref erence");
286 break; 286 break;
287 badaddr:
288 panicstring("invalid memory address or nil pointer dereference") ;
289 case SIGFPE: 287 case SIGFPE:
290 switch(g->sigcode0) { 288 switch(g->sigcode0) {
291 case FPE_INTDIV: 289 case FPE_INTDIV:
292 panicstring("integer divide by zero"); 290 panicstring("integer divide by zero");
293 case FPE_INTOVF: 291 case FPE_INTOVF:
294 panicstring("integer overflow"); 292 panicstring("integer overflow");
295 } 293 }
296 panicstring("floating point error"); 294 panicstring("floating point error");
297 } 295 }
298 panicstring(sigtab[g->sig].name); 296 panicstring(sigtab[g->sig].name);
299 } 297 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b