Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Ashutosh <ashutoshpal2006@gmail.com>
To: Klaus Rudolph <lts-rudolph@gmx.de>
Cc: gdb@sourceware.org
Subject: Re: Using C++ code inside gdb
Date: Fri, 09 Oct 2015 03:20:00 -0000	[thread overview]
Message-ID: <CADHm+zt377vKH=-4T5W9x=f=fHDhxfvDw6GOKXeD+33Hw6pi7g@mail.gmail.com> (raw)
In-Reply-To: <trinity-a6c327d7-3c17-4ad4-90d9-d0aca0d72c07-1444309529343@3capp-gmx-bs23>

Hi Klaus,

Thanks for your reply. Actually, I want to extend gdb to support
targets with multiple memories and for that I wanted to add this
module inside gdb code. This module would be called from with-in the
gdb code, for example, when a user prints a variable on the
command-line, gdb before issuing a request to the target to read the
corresponding memory address, would first call my module to get some
memory-specific info. And, I want the module to be contained inside a
namespace like C++ class. So, basically, I want to add C++ code inside
the gdb code and was looking for any guidelines/caveats regarding the
same.
The solution that you propose doesn't fit the scenario I am shooting
for, as I want the module functions to be called from with-in gdb and
not from the command-line interface. Sorry for not clarifying the
context earlier.

Thanks and Regards,
ash




On Thu, Oct 8, 2015 at 6:35 PM, Klaus Rudolph <lts-rudolph@gmx.de> wrote:
>
>>
>> I plan to add a standalone module inside gdb code that contains
>> information about the memories in the target, but want to organize it
>> in the form of a C++ class. My question is: Has anybody earlier tried
>> adding C++ code to gdb code-base and how easy it would be to do so?
>> Any guidelines?
>>
>
> You can call every function/method with "print funcName" from gdb command line. So if you add your debug code to your executable you should be able
> to run every function from your debug extension. You must take care that your debug code is not optimized out because
> you have no calls from your application to the debug code itself. So you do not need any changes to the debugger or gdbserver
> itself.
>
> But maybe I have a misunderstanding from your question...
>
> Regards
>  Klaus


  reply	other threads:[~2015-10-09  3:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 10:57 Ashutosh
2015-10-08 13:05 ` Aw: " Klaus Rudolph
2015-10-09  3:20   ` Ashutosh [this message]
2015-10-09  4:29     ` Duane Ellis
2015-10-09  6:08       ` Ashutosh
2015-10-09  9:41         ` Pedro Alves
2015-10-09 10:00           ` vijay nag
2015-10-09 10:06             ` Pedro Alves
2015-10-10 21:32           ` Mike Frysinger
2015-10-11  8:57             ` Mike Frysinger
2015-10-11 14:23               ` Joel Brobecker

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='CADHm+zt377vKH=-4T5W9x=f=fHDhxfvDw6GOKXeD+33Hw6pi7g@mail.gmail.com' \
    --to=ashutoshpal2006@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=lts-rudolph@gmx.de \
    /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