srosset | 5 Dec 2009 08:17
Picon

add-symbol-file cmd: how to find address of a shared library?


When using the "add-symbol-file" command, how do I find the memory address at
which a shared library has been loaded (on Linux x86)?
   add-symbol-file filename -ssection address

The doc states: address should be the memory address at which the file has
been loaded; GDB cannot figure this out for itself. 
Thanks!

--

-- 
View this message in context: http://old.nabble.com/add-symbol-file-cmd%3A-how-to-find-address-of-a-shared-library--tp26653470p26653470.html
Sent from the Gnu - gdb - General mailing list archive at Nabble.com.

Rohit Girme | 6 Dec 2009 20:50
Picon
Favicon

Adding new custom gdb/mi command

Hi,

I have added a new feature to the gdb which has its own CLI command. Now I want to interface this new feature to Eclipse. I am using the CDI for integration. I need a new MI command which I can use to call from Eclipse CDI interface.
I could not find any documentation regarding custom gdb/mi commands. Can anyone help me with the same?

--
Thanks & Regards,
Rohit Girme

Rohit Girme | 8 Dec 2009 19:59
Picon
Favicon

gdb/MI commands

Hi,

I want to add a new MI command to the MI interface of gdb. Does anyone know where I will find the source code for the MI interface with gdb? Is it part of the gdb source code?

--
Thanks & Regards,
Rohit Girme

Charles Manning | 9 Dec 2009 22:05
Picon

Re: gdb/MI commands

On Wednesday 09 December 2009 07:59:23 Rohit Girme wrote:
> Hi,
>
> I want to add a new MI command to the MI interface of gdb. Does anyone know
> where I will find the source code for the MI interface with gdb? Is it part
> of the gdb source code?

Google gdb mi and there's a wealth of info.

pilgrim2 | 24 Dec 2009 02:17
Picon
Picon

Why "call cos(.2)" returns garbage?


Hi, 

  I was wondering how come the call to "call cos(.2)" returns the wrong
answer in:

#include <math.h>
double    (*fcn)(double);
main() 
{
  double t;
  fcn = cos;
  t=cos(.2);
  t=cos(-.2);
}

(gdb) call cos(.2)
$16 = 104
(gdb) call fcn(.2)
$17 = 0.98006657784124163

Thanks,

Linh
--

-- 
View this message in context: http://old.nabble.com/Why-%22call-cos%28.2%29%22-returns-garbage--tp26909516p26909516.html
Sent from the Gnu - gdb - General mailing list archive at Nabble.com.

Vamsi Krishna | 25 Dec 2009 01:04
Picon
Favicon

Re: Why "call cos(.2)" returns garbage?

Hello,

Looks like 'gdb' is missing debug information about the function 'cos' , and the debugger implicitly assumes all the functions return an 'int' , if the function is not compiled in debug mode.

I derive my explanation from the following test case.

1. Create a function 'double test_cos(double)' and compile it in optimized mode with -O3 using gcc
 "$gcc -c -O3 test1.c"

2. Complie the file containing the 'main' function in debug mode
"$gcc -g test.c test1.o -lm"

============[gdb a.out]====================

(gdb) list 0
1       #include <math.h>
2       #include "test1.h"
3       double    (*fcn)(double);
4       main()
5       {
6                double t;
7                 fcn = cos;
8                  t=cos(.2);
9                   t=cos(-.2);
10                      test_cos(.2);
(gdb) call fcn(0.2)
$4 = 0.98006657784124163
(gdb) call cos(0.2)
$5 = -1073792992
(gdb) call test_cos(0.2)
$6 = -1073792992
=====================================

============[test1.h]=================
#ifndef _test_1_h
#define _test_1_h
double test_cos(double);
#endif
====================================

============[test1.c]==================
#include<math.h>
#include "test1.h"
double test_cos(double a){
        return cos(a);
}
====================================

============[test.c]==================
#include <math.h>
#include "test1.h"
double    (*fcn)(double);
main()
{
         double t;
          fcn = cos;
           t=cos(.2);
            t=cos(-.2);
                test_cos(.2);
}
===================================

May be the developers of gdb can you more details.

also
=======================================
(gdb) call cos
$6 = {<text variable, no debug info>} 0xc325d0 <cos>
=======================================


Thank you,
Vamsi Kundeti



On Wed, Dec 23, 2009 at 8:17 PM, pilgrim2 <phan <at> mail.jpl.nasa.gov> wrote:

Hi,

 I was wondering how come the call to "call cos(.2)" returns the wrong
answer in:

#include <math.h>
double    (*fcn)(double);
main()
{
 double t;
 fcn = cos;
 t=cos(.2);
 t=cos(-.2);
}

(gdb) call cos(.2)
$16 = 104
(gdb) call fcn(.2)
$17 = 0.98006657784124163

Thanks,

Linh
--
View this message in context: http://old.nabble.com/Why-%22call-cos%28.2%29%22-returns-garbage--tp26909516p26909516.html
Sent from the Gnu - gdb - General mailing list archive at Nabble.com.






--
Sincerely,
Vamsi

Gmane