Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/testsuite] backtrace in mixed language application
@ 2007-08-10 10:10 Jerome Guitton
  2007-08-15 18:57 ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Jerome Guitton @ 2007-08-10 10:10 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Testcase for http://sourceware.org/ml/gdb-patches/2007-08/msg00201.html,
to commit in the gdb.ada directory.


2007-08-10  Jerome Guitton  <guitton@adacore.com>

        * gdb.ada/lang_switch/lang_switch.adb: New file.
        * gdb.ada/lang_switch/foo.c: Ditto.
        * gdb.ada/lang_switch.exp: New testcase.

OK to add?
Thanks in advance,
Jerome

[-- Attachment #2: lang_switch.exp --]
[-- Type: text/plain, Size: 1673 bytes --]

# Copyright 2007 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.  

if $tracelevel then {
    strace $tracelevel
}

load_lib "ada.exp"

set testdir "lang_switch"
set testfile "${testdir}/lang_switch"
set cfile "${testdir}/foo"
set adasrcfile ${srcdir}/${subdir}/${testfile}.adb
set csrcfile ${srcdir}/${subdir}/${cfile}.c
set cobject  ${objdir}/${subdir}/${cfile}.o
set binfile ${objdir}/${subdir}/${testfile}

file mkdir ${objdir}/${subdir}/${testdir}
gdb_compile "${csrcfile}" "${cobject}" object [list debug]
if {[gdb_compile_ada "${adasrcfile}" "${binfile}" executable [list debug]] != "" } {
  return -1
}

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

set bp_location [gdb_get_line_number "STOP" ${csrcfile}]
runto "foo.c:$bp_location"

# Make sure that the language is switched to Ada for the second frame
# by checking the string parameter.
gdb_test "bt" \
         ".*#1.*lang_switch\.ada_procedure\\s*\\(msg=$hex\\).*" \
         "backtrace"

[-- Attachment #3: lang_switch.adb --]
[-- Type: text/plain, Size: 468 bytes --]

with System;

procedure Lang_Switch is
   pragma Linker_Options ("foo.o");

   function C_Procedure (Msg : String) return Integer;
   pragma Import(C, C_Procedure, "c_procedure");

   procedure Ada_Procedure (Msg : String) is
      C_Msg : String (1 .. 1024);
      Tmp_Int : Integer;
   begin
      C_Msg  (1 .. Msg'length   + 1) := Msg & Ascii.Nul;
      Tmp_Int := C_Procedure (Msg => C_Msg);
   end Ada_Procedure;

begin
   Ada_Procedure ("msg");
end Lang_Switch;

[-- Attachment #4: foo.c --]
[-- Type: text/x-csrc, Size: 56 bytes --]


int c_procedure (char* msg)
{
  return 0; /* STOP */
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA/testsuite] backtrace in mixed language application
  2007-08-10 10:10 [RFA/testsuite] backtrace in mixed language application Jerome Guitton
@ 2007-08-15 18:57 ` Joel Brobecker
  2007-08-15 19:01   ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2007-08-15 18:57 UTC (permalink / raw)
  To: Jerome Guitton; +Cc: gdb-patches

Hello Jerome,

> 2007-08-10  Jerome Guitton  <guitton@adacore.com>
> 
>         * gdb.ada/lang_switch/lang_switch.adb: New file.
>         * gdb.ada/lang_switch/foo.c: Ditto.
>         * gdb.ada/lang_switch.exp: New testcase.

This looks fine to me, save for one little thing: Make sure to add
the copyright headers to foo.c and lang_switch.adb as well.

That reminds me that we're trying to move to GPLv3, and your patch
actually refers to GPLv2. I think it's fine for this patch, we'll
fix it later with the rest of the files when we manage to do the
transition. But do give this a few days for people to object before
you commit.

One tiny comment: I would prefer if foo.c followed the GNU coding
standards too, so would you mind formatting it so that the function
name starts at the beginning of the line?

Thanks,
-- 
Joel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA/testsuite] backtrace in mixed language application
  2007-08-15 18:57 ` Joel Brobecker
@ 2007-08-15 19:01   ` Daniel Jacobowitz
  2007-08-15 19:17     ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-08-15 19:01 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Jerome Guitton, gdb-patches

On Wed, Aug 15, 2007 at 12:01:10PM -0700, Joel Brobecker wrote:
> That reminds me that we're trying to move to GPLv3, and your patch
> actually refers to GPLv2. I think it's fine for this patch, we'll
> fix it later with the rest of the files when we manage to do the
> transition. But do give this a few days for people to object before
> you commit.

It's easy enough to fix up files afterwards.  We don't need to worry
about it.

We do, however, need to get going.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA/testsuite] backtrace in mixed language application
  2007-08-15 19:01   ` Daniel Jacobowitz
@ 2007-08-15 19:17     ` Joel Brobecker
  0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2007-08-15 19:17 UTC (permalink / raw)
  To: Jerome Guitton, gdb-patches

> > That reminds me that we're trying to move to GPLv3, and your patch
> > actually refers to GPLv2. I think it's fine for this patch, we'll
> > fix it later with the rest of the files when we manage to do the
> > transition. But do give this a few days for people to object before
> > you commit.
> 
> It's easy enough to fix up files afterwards.  We don't need to worry
> about it.
> 
> We do, however, need to get going.

I agree. I'm trying to keep this in today's schedule, hopefully
tomorrow at the latest.

BTW, Jerome: Let's wait until your corresponding change is finalized
and checked in. I don't think there is any point in introducing a
testcase that we know will fail.

-- 
Joel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-15 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10 10:10 [RFA/testsuite] backtrace in mixed language application Jerome Guitton
2007-08-15 18:57 ` Joel Brobecker
2007-08-15 19:01   ` Daniel Jacobowitz
2007-08-15 19:17     ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox