Re: [patch][python] Add symbol, symbol table and frame block support to GDB API

Tom Tromey
2010-02-23T23:05:50Z

>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Tom> I think this could use a NEWS entry. I suggest waiting until my earlier
Tom> patch is approved, then adding items to that block... assuming your
Tom> patch goes in before 7.1. Otherwise, add a new Python block in the
Tom> post-7.1 changes.

Phil> I included one in the patch I sent. Here is the hunk:

Thanks, I must have missed it. Sorry about that.

Phil> This hunk puts it in the 7.1 release section. I'll move it when we
Phil> figure out what release it will be in (as of today, looks like 7.2).

Yeah, 7.2 now.

Phil> I ended up just reusing the FRAPY_REQUIRE_VALID code that is in
Phil> py-frame.c.

That code is bogus too, but I didn't want to burden you with this, at
least not for this patch ;).

Phil> +static PyObject *
Phil> +sympy_str (PyObject *self)
[...]
Phil> + s = xstrprintf ("symbol for %s",
Phil> + SYMBOL_PRINT_NAME (symbol));

Tom> Why not just have this be SYMBOL_PRINT_NAME?

Tom> I forgot the difference between the various python to-string methods.
Tom> Maybe this one is supposed to be more verbose? Let me know.

Phil> One of the tricky things I've found in merging work is I'm often not
Phil> the original author of that work.

Totally understood. This is all my fault or Thiago's :)

Phil> And my understanding of Python's "print object"
Phil> -> string is more for human consumption that for comparison or
Phil> assingment. That being said, I've no strong feelings on it. I did not
Phil> change it in this patch. If you want it changed, I'll happily do it.

Yes, I think we should change it so that "print foo" or "str(foo)"
yields the "most natural" name.

In this case it is just the print name.

Phil> + s = xstrprintf ("symbol table for %s",
Phil> + symtab->filename);

Tom> Also as above.

Phil> I'm not sure what this means, is it referring to the sympy_str
Phil> comment?

Yeah, sorry, do like sympy_str. In this case I think it should just
return the filename.

Phil> + s = xstrprintf ("symbol and line for %s, line %d", filename,
Phil> + sal->line);
Tom>

Phil> Ditto, sympy_str comment.

I am not sure what is nicest to return here; it is probably fine to
leave it as-is for the time being.

thanks,
Tom