/* Target-dependent code for PowerPC systems using the SVR4 ABI
for GDB, the GNU debugger.
- Copyright (C) 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009
+ Copyright (C) 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GDB.
regcache_cooked_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
/* Use the func_addr to find the descriptor, and use that to find
- the TOC. */
+ the TOC. If we're calling via a function pointer, the pointer
+ itself identifies the descriptor. */
{
- CORE_ADDR desc_addr;
- if (convert_code_addr_to_desc_addr (func_addr, &desc_addr))
+ struct type *ftype = check_typedef (value_type (function));
+ CORE_ADDR desc_addr = value_as_address (function);
+
+ if (TYPE_CODE (ftype) == TYPE_CODE_PTR
+ || convert_code_addr_to_desc_addr (func_addr, &desc_addr))
{
/* The TOC is the second double word in the descriptor. */
CORE_ADDR toc =