public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "palves at redhat dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug python/16236] add $_memoize function Date: Tue, 29 Apr 2014 13:55:00 -0000 [thread overview] Message-ID: <bug-16236-4717-YP2WhemqcQ@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-16236-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=16236 Pedro Alves <palves at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |palves at redhat dot com --- Comment #2 from Pedro Alves <palves at redhat dot com> --- For string, one can currently do: (gdb) set $foo = (char *) "asdf" (gdb) p $foo $1 = 0xd051e0 "asdf" For arrays, one can do: (gdb) p $bar = (int *) {1, 2} $2 = (int *) 0xd05250 For scalars, I've seem people do two-step malloc+set: (gdb) p (int *) malloc (sizeof (argc)) $3 = (int *) 0xd055e0 (gdb) p *$3 = argc $4 = 1 Though one can just use the array syntax there too, simply allocating a one-element array: (gdb) p (int*) { argc } $5 = (int *) 0xd05650 (gdb) p *$29 $6 = 1 typeof doesn't seem to work here, unfortunately: (gdb) p (typeof (argc) *) { argc } A syntax error in expression, near `*) { argc }'. I'm not immediately seeing what's the symtax to lay a structure/object in a expression, but if possible, I imagine that adding a cast to a struct pointer might be a way to force coercing the object to memory too. Not saying $_memoize wouldn't be useful at all -- just pointing at current syntax/workarounds. Even if not strictly necessary, it might be a convenient shortcut. -- You are receiving this mail because: You are on the CC list for the bug.
prev parent reply other threads:[~2014-04-29 13:55 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-11-25 16:32 [Bug python/16236] New: " tromey at redhat dot com 2014-02-26 20:55 ` [Bug python/16236] " tromey at redhat dot com 2014-04-29 13:55 ` palves at redhat dot com [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-16236-4717-YP2WhemqcQ@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).