Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Kevin Pouget <kevin.pouget@gmail.com>
To: mark florisson <markflorisson88@gmail.com>, gdb@sourceware.org
Subject: Re: Python objfile-gdb.py file -- how to handle reloading properly ?
Date: Tue, 22 Mar 2011 15:00:00 -0000	[thread overview]
Message-ID: <AANLkTi=i9HhdUE5oGyxQp3OG9fepijnm1sEXMoo2Cy0z@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikZX2JvZF4bNYh8ZQR-e-bqLS=+zZq_m_b2Y+an@mail.gmail.com>

Thanks for your answer Mark

(I know I'm not very good at Python, I use it only since a few days :)

>> class my_list:
>>    list = []
>>
>>    def addToList(elt):
>>        my_list.__class__.list.append(elt)
>
> That should read 'self.list.append(elt) (and you forgot the first
> parameter 'self' to 'addToList').

actually, it's rather

@staticmethod
def addToList(elt):

that I wanted to do, that is, access a  *static* attribute

> Yes, it is quite terrible (also, don't use a bare 'except' clause). If
> you want your code to be autoloaded with your object file, have your
> script import your actual code instead (that can be installed using
> distutils). Modules are cached, so it will only be imported once.

what would you think about caching the already-loaded module list, and
allowing them to register a callback?
That's for instance what is done in `linux-thread-db.c` to detect the
loading of the libpthread.so, and that's pretty much what I would like
to do.

(I mean, if you guys feel like it's an interesting feature but no one
fancies doing it, I could give it a try)

> Although not related directly to your problem, I suggest reading
> docs.python.org/tut.

will do, thanks



Kevin


  parent reply	other threads:[~2011-03-22 15:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 14:07 Kevin Pouget
     [not found] ` <AANLkTikZX2JvZF4bNYh8ZQR-e-bqLS=+zZq_m_b2Y+an@mail.gmail.com>
2011-03-22 15:00   ` Kevin Pouget [this message]
2011-03-22 17:00 ` Tom Tromey
     [not found]   ` <AANLkTi=XEP8x27_BNr6NwS09Ra=nNu=CA6qrrpUJ5N8Z@mail.gmail.com>
2011-03-23  9:06     ` Kevin Pouget
     [not found]       ` <AANLkTikp_m_zwsUPmmEvgHiEKxBidNd-MNY4cTrprynU@mail.gmail.com>
     [not found]         ` <AANLkTi=66tRSet6UgrtBpZzEU5o_PmTdazdkB-NnWEVZ@mail.gmail.com>
2011-03-23 10:46           ` Kevin Pouget
2011-03-23 18:26     ` Tom Tromey

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='AANLkTi=i9HhdUE5oGyxQp3OG9fepijnm1sEXMoo2Cy0z@mail.gmail.com' \
    --to=kevin.pouget@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=markflorisson88@gmail.com \
    /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