Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c - How to set conditional breakpoint if malloc returns NULL via gdb -


sample source code:

#include        <stdio.h> #include        <stdlib.h> #include        <errno.h>  #define         gigabyte        1024*1024*1024  int main (void) {         void    *foo;         int     result;          foo = (void *) malloc (gigabyte*5);         result = errno;          if (foo != null) {                 return 2;         } else {                 fprintf (stderr, "error: %d\n", result);                 return 1;         }         return 0; } 

question:

  • how instruct gdb (# gdb -silent ./huge_malloc) stop/halt execution, if malloc() returns 0x0, without checking if foo 0x0

you identify exit point of malloc , put conditional breakpoint there. such as:

(gdb) tbreak main breakpoint 1 @ 0x4005c4: file t.c, line 13. (gdb) r starting program: /var/tmp/a.out  main () @ t.c:13 13          foo = malloc (64); (gdb) br *__libc_malloc+211 if $rax==0 breakpoint 2 @ 0x7f26d143ea93 (gdb) n 14          foo = malloc (gigabyte*64); (gdb) p foo $1 = (void *) 0x21dc010 (gdb) n  breakpoint 2, 0x00007f26d143ea93 in malloc () /lib/libc.so.6 

note, have added malloc call succeeds first, illustrate breakpoint triggers null return value. breakpoint address may vary libc versions, found stepping through malloc nexti until hit ret instruction.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -