Gdb Error Attempt Dereference Generic Pointer
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Attempt to dereference a generic pointer. up vote 2 down vote favorite I am trying to work with directly with some low level memory stuff. I am filling a buffer with some data and then copying it to a larger buffer. I wrote this function to help with some float data: void copy_float_buffer(void* dest, size_t dest_index, void* src, size_t src_index, size_t num_to_copy) { memcpy(&dest[dest_index], &src[src_index], num_to_copy * sizeof(float)); } I currently have two different buffers and two of each type. float buffa[12]; // i have two of these float buffb[12]; // and two of these as well Then have two larger buffers that will hold the those buffers back to back. float buffera[24]; //holds 2 buffa float bufferb[24] //holds 2 buffb I have simple for loop that does some calculate and fills buffa and buffb then I use the copy_float_buffers command to fill in the buffers. I do it like this. typedef struct { float buffa[12]; float buffb[12]; } buffs; buffs* b; for (int j = 0; j < 2; j++) { b = calloc(1, sizeof(buffs)); } for (int i = 0; i < 12; i++) { b->buffa[i] = vmathRandRange(21); b->buffb[i] = vmathRandRange(21); } for (int i = 0; i < 12; i++) { /* printf("index:%d value:%f \n", i, b->buffa[i]); */ /* b->buffa[i] = vmathRandRange(21); */ copy_float_buffer(v_buff, (sizeof(float) * i) * 12, b->buffa, (sizeof(float) * i) * 12, 12); c
is not a local, e.g., 'lineno' or 'yytext' graph display lineno # variable lineno now appears in the stippled area To run taking input from a file: r < lin1.c Menu pick: status | backtrace -- displays stack trace status | registers -- displays registers status menu pick displays in a separate window Can also display these using: Data | status displays | choose: local variables of current stack frame -- locals backtrace of the stack list of all registers and their contents http://stackoverflow.com/questions/34728881/attempt-to-dereference-a-generic-pointer data | status displays display in the 'stippled' window -- top window of ddd data | displays shows current displays GDB Cheat Sheet from the net awhile back The following were done on magi, which is running GCC: (GNU) 3.2.2 20030222 on Red Hat Linux 3.2.2-5 Creating assembler source from C source gcc t2.c // produces t2.s -- assembly code generated by the http://cs.sou.edu/~nordquip/cs450/gdbhelps.html c compiler To run this code, do the following: as -o t2.o t2.s // produces t2.o -- an object module ready for linking gcc t2.o // produces a.out -- an executable, which you can run as ./a.out gdb a.out // debugs a.out Running gdb The following information is from http://www.gnu.org/manual/gdb-5.1.1/html_mono/gdb.html Showing a listing of your program disas main // shows assembly listing for main - don't need to have generated debugging info Setting breakpoints b *main // set breakpoint at the start of main b *main+55 // set breakpoint at this address in your assembly code (as shown by disas) b *_start // set breakpoint at as close as I can find to the real beginning of the program i b // show breakpoints currently set dis 1 // disable breakpoint 1 dis 1-3 // disable breakpoints 1 through 3 ena 1 // (re)enable breakpoint 1 Running and Continuing your program r // (Re)start your program from the beginning si // step one assembler instruction c // continue the program. Goes until the next breakpoint or the end of the program. Displaying registers and using automatic displays i reg // show the
Churchに集合してそこから車で Wunderlich County Parkへ。雑談しつつてくてく1時間半ほど山歩き。 Menlo Parkに戻ってCafe Borroneで ブランチを食べました。そこで「opaque typeをdebuggerで見たい時ってどうするのがいいんですかね?」という話がでたので、ちょっと試してみました。 libraryなどで、内部では具体的な型が定義されているけど、使う側にはgenericなpointer(void *)としてしか見せていない場合です。例えばこんなかんじ。 # library側 % cat http://blogger.ukai.org/2009/04/opaque-type.html a.h void* create_foo(); void set_foo(void* p, int i); % cat liba.c #include