This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Xtensa port


Hi Daniel,

I hope I know how to handle all your other comments. But, this one is not easy:
+/* get_fp_num() returns the register number of the frame pointer for the frame
+ specified by pc. Depending on how the function was compiled, the fp could
+ be either a1 (sp) or another register set by the compiler.
+ Note: it returns register number for an Ax, not for ARx.
+
+ We extract the FP register number from the DWARF info generated by the
+ compiler. If anything is wrong with the DWARF info or there is no DWARF
+ info at all we return A1_REGNUM. */
+
+static int
+get_fp_num (CORE_ADDR pc)
+{
+ struct symtab_and_line debug_info;
+ struct symbol *func_sym;
+
+ DEBUGTRACE ("get_fp_num (pc = 0x%08x)\n", (int) pc);
+
+ debug_info = find_pc_line (pc, 0);
+ /* If there is no debug info return A1. */
+ if (debug_info.line == 0)
+ return A1_REGNUM;
+
+ func_sym = find_pc_function (pc);
+ if (func_sym)
+ {
+ if (SYMBOL_OPS (func_sym) == &dwarf2_locexpr_funcs)

No way. I don't know what you need this information for, but we have to find some way to get it that does not require grubbing around in the private data structures of the symbol reader
I need an FP number. And, the most reliable source for this information is DWARF data.

When GDB generates offsets and addresses for, say, local variables, it uses exactly the same technique I used here. But, it's done in a specific context, which is not available in xtensa-tdep.c. I was not able to find a clear "utility" routine to get an FP number for a given function. So I just implemented it. Can you give me some hints on how could it be done differently, please ?

If there is no such "utility" request ( which I thought is the case ), I'd need to introduce it. That would be an update to the generic part of GDB. And, I was given specific instructions to avoid any updates to the generic code, when I submit an architecture port.

-- Maxim





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]