From: Doug Evans <dje@google.com>
To: Richard Silverman <res@qoxp.net>
Cc: Paul Koning <paul_koning@dell.com>,
GDB Mailing List <gdb@sourceware.org>
Subject: Re: teaching gdb about new types?
Date: Tue, 10 May 2011 23:42:00 -0000 [thread overview]
Message-ID: <BANLkTikmbaEYfFcuDf83oHTM=VA9KZ2e8w@mail.gmail.com> (raw)
In-Reply-To: <alpine.OSX.2.01.1104292254280.1166@darwin.oankali.net>
On Fri, Apr 29, 2011 at 8:02 PM, Richard Silverman <res@qoxp.net> wrote:
> On Fri, 29 Apr 2011, Paul Koning wrote:
>
>> If you're worried about types rather than line numbers, I would think that
>> all you'd need is a symbol table that has the right type definitions in it.
>> If you know what they are supposed to be, you can supply such a symbol
>> table easily enough.
>>
>> paul
>
> I tried that -- I created a little file:
>
> ----------------------------------------
> #include <pthreads.h>
>
> pthread_cond_t p;
> pthread_mutex_t m;
> ----------------------------------------
>
> ... and built an object from it. However, I can't find a way to get gdb to
> use it while debugging an existing program, that is, to add the type
> definitions in that object to its existing set. The commands "symbol-file"
> and "add-symbol-file" seem likely candidates, but they don't appear to do
> it.
I've used add-symbol-file to accomplish exactly this kind of thing.
Can you elaborate on what didn't work?
Here's a quick example to illustrate.
bash$ cat foo.c
#include <pthread.h>
pthread_cond_t p;
pthread_mutex_t m;
bash$ gcc -g -c foo.c
bash$ gdb hello.x
[...]
(gdb) pty pthread_cond_t
No symbol "pthread_cond_t" in current context.
(gdb) add-symbol-file foo.o 0
add symbol table from file "foo.o" at
.text_addr = 0x0
(y or n) y
(gdb) pty pthread_cond_t
type = union {
struct {
int __lock;
unsigned int __futex;
long long unsigned int __total_seq;
long long unsigned int __wakeup_seq;
long long unsigned int __woken_seq;
void *__mutex;
unsigned int __nwaiters;
unsigned int __broadcast_seq;
} __data;
char __size[48];
long long int __align;
}
(gdb)
prev parent reply other threads:[~2011-05-10 23:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-29 18:36 Richard Silverman
2011-04-29 18:57 ` Paul Koning
2011-04-29 20:43 ` Richard Silverman
2011-04-29 20:53 ` Paul Koning
2011-04-30 3:02 ` Richard Silverman
2011-05-10 23:42 ` Doug Evans [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='BANLkTikmbaEYfFcuDf83oHTM=VA9KZ2e8w@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb@sourceware.org \
--cc=paul_koning@dell.com \
--cc=res@qoxp.net \
/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: link
Be 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