[Pdbg] [PATCH v2 13/16] pdbg/gdbserver: Add in basic skeleton for a gdbserver on p8
Rashmica Gupta
rashmica.g at gmail.com
Mon Sep 10 11:43:30 AEST 2018
On Mon, 2018-09-10 at 11:33 +1000, Alistair Popple wrote:
> Hi Rashmica,
>
> I get the following error trying to build this series:
>
> make --no-print-directory all-am
> CCLD pdbg
> src/pdbg-pdbgproxy.o: In function `get_gprs':
> /home/alistair/Source/pdbg/src/pdbgproxy.c:109: undefined reference
> to `mtspr'
> /home/alistair/Source/pdbg/src/pdbgproxy.c:112: undefined reference
> to `ram_instructions'
> /usr/bin/ld: .libs/pdbg: hidden symbol `ram_instructions' isn't
> defined
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
> Makefile:1105: recipe for target 'pdbg' failed
> make[1]: *** [pdbg] Error 1
> Makefile:792: recipe for target 'all' failed
> make: *** [all] Error 2
>
interesting... I don't get this... How are you building this?
> Which is because we don't export ram_instructions from libpdbg. We
> only use it
> here though:
>
> > +/* 32 registers represented as 16 char hex numbers with null-
> > termination */
> > +#define REG_DATA_SIZE (32*16+1)
> > +static void get_gprs(uint64_t *stack, void *priv)
> > +{
> > + char data[REG_DATA_SIZE] = "";
> > + uint64_t regs[32] = {0};
> > + uint64_t opcodes[32] = {0};
> > + int i;
> > +
> > + for (i = 0; i < 32; i++) {
> > + opcodes[i] = mtspr(277, i);
> > + }
> > +
> > + if(ram_instructions(thread_target, opcodes, regs,
> > ARRAY_SIZE(opcodes), 0))
> > + PR_ERROR("Error reading gprs\n");
> > +
> > + for (i = 0; i < 32; i++) {
> > + PR_INFO("r%d = 0x%016" PRIx64 "\n", i, regs[i]);
> > + snprintf(data + i*16, 17, "%016" PRIx64 ,
> > __builtin_bswap64(regs[i]));
> > + }
> > +
> > + send_response(fd, data);
> > +}
>
> Nick recently added functionality to the library in
> ram_state_thread() to read
> all the GPRs (and some other registers) so it would be best to call
> that here
> instead of reimplementing it, which would also solve the build issue.
>
Will do that :)
> - Alistair
More information about the Pdbg
mailing list