Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
102 user(s) are online (52 user(s) are browsing Forums)

Members: 1
Guests: 101

smf, more...

Headlines

Forum Index


Board index » All Posts (billyfish)




Re: GDB
Just popping in
Just popping in


@kas1e

Sorry for the hold up Roman

I can't currently get on my amiga to test whether it works but I've uploaded a version with some "possible working" breakpoint code in there I've tried to integrate what Aflkil does in Spotless.

Once I've got a new hard drive in there I'll be able to boot up my amiga and check whether it actually works!


Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Seein target_wait() , x5k received "signal = SIGBUS" while on peg2 we receive there "signal = SIGTRAP"Also on x5k status 1640258176, while on peg2 status 1750208704 whatever it means ..

So what did it means at all :)? That on x5k signals messed upProbably we can find out the answer after breakpoint_insert addedthen we can add printfs to signals handling to see wtf happensI very muych hope it will be possible to work around it without the need for fixes in the kernel.


Could well be. Once I've got the debug hook and breakpoint code in which will be pretty quick to do, it's just finding the time, then we can see. The trap_to_signal () function may need to be adapted for the x5000 possibly.

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Ah good spot, I'd started going down the path of tidying up the 6.3 version but Alfkil's Spotless one looks nicer, using APIs like IMMU->GetPhysicalAddress() rather than doing the relocation stuff by hand. I'll copy/steal that idea

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Quote:

Do you think messages is important enough for now, or can wait in favor of breakpoints stuff ?


Can do, the messages will mainly be for exceptions like null pointer crashes or memory access errors. Should be easy to add in but no need to hold up breakpoints for it. So my current plan is make sure the elf relocation code is correct, as the breakpoint stuff needs that, then the breakpoints can go in. The messages handling would be pretty quick after that. The next part would be the partial memory transfer stuff which is the part of the updated gdb API which the old port didn't have.

Quote:

: Btw, do you have a paypal acc ? Want to donate a bit for the work you already do and will happy to donate from time to time if we can deal to some working version :)


Thanks Roman, however there's really no need. The reward of having an actual working debugger will be more than enough!
🙂

If we can get this working then development will become soooooo much easier. Personally I should be able to make much more progress on porting the latest libgit2 stuff, etc.

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Cheers Roman Yeah it's still missing the breakpoint stuff and dealing with the messages in amigaos_wait () for any messages that aren't CTRL+C or CTRL+D.

I don't like the is_process_alive() function and having to call it, there's got to be a cleaner way of doing that. Similarly the way that I'm getting the seglist for passing to CreateNewProcTags () could well need to be improved.

I've just added another minor commit with some minor tidying up of the code.

I haven't made a pull request yet as the code is only half finished, if you want me to I can though, just say the word.

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e


Yup that's currently how I'm doing it. I've been incrementally adding in the required functions in the order that GDB is calling them and I'm almost there in having a version that can debug a file ok. It's now becoming a lot clearer on how it's all put together so we should have a better chance of understanding what's going on as we hit each problem.

I reckon I should be able to make a pull request in the next day or two.

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

You'll love the reason for this

For some, god only knows why, reason, the makefile code generation that builds and adds the calls to the initialize functions in init.c requires that the functions begin with "_initialize" and must be at the start of a line, wtf!

So if, like me, you had

void _initialize_amigaos_nat (void)
{
    
printf ("_initialize_amigaos_nat \n");
    
init_amigaos_ops ();
    
add_target (&amigaos_ops);
}


rather than

void
_initialize_amigaos_nat 
(void)
{
    
printf ("_initialize_amigaos_nat \n");
    
init_amigaos_ops ();
    
add_target (&amigaos_ops);
}


then the function call wouldn't be added to be init.c! Whoever had that as an idea, especially without explictly documenting it in big letters, is not someone I'd like working for me!

The memset call that I added without compiling yesterday had the args the wrong way around, oops!

memset (&amigaos_ops0sizeof (struct target_ops));


Now it runs to "PC register is bit available", so that's the next function to fill back in along with opening the required libs and interfaces like IElf, IDebug, IMMU, etc. which I'll add in too.


Go to top


Re: OS4 Reaction programming question (beginner)
Just popping in
Just popping in


@SinanSam460


struct Window *win_p NULL;
    
/* Obtain window pointer from the window object. */
IIntuition -> GetAttrs (gb_WindowObjWINDOW_Window, &win_p,  TAG_DONE);

IIntuition->SetGadgetAttrs (gb_StringGadwin_pNULLSTRINGA_TextVal"change"TAG_DONE);


Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Here is a stripped back init_amigaos_ops (). we may have a lot to fill in! But this way we know that there won't be any uninitialised values in amigaos_ops. I'm expecting that quite a lot of them will be trivial no-op functions. There's more info at [link]https://www.embecosm.com/appnotes/ean3/embecosm-howto-gdb-porting-ean3-issue-2.html#sec_target_ops[/link]


/* Native-dependent code for AmigaOS on PowerPC
   for GDB, the GNU debugger.

   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.

   This file is part of GDB.

   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.  */

#include "defs.h"
#include "gdbcore.h"
#include "inferior.h"
#include "regcache.h"
#include "value.h"
#include "gdb_string.h"
#include "elf/mips.h"
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
#include "buildsym.h"
#include "ppc-tdep.h"
#include "stabsread.h"
#include "gdb-stabs.h"
#include "gdbthread.h"
#include "command.h"
#include "libbfd.h"

#undef HAVE_DLFCN_H
#ifdef HAVE_DLFCN_H
#include "solib-amigaos.h"
#endif

#include <exec/execbase.h>
#include <exec/tasks.h>

#if !defined(NDEBUG)
#define FUNC  IExec->DebugPrintF("\033[37m<%s>\033[39m\n", __PRETTY_FUNCTION__);
#define FUNCX IExec->DebugPrintF("\033[37m</%s>\033[39m\n", __PRETTY_FUNCTION__);
#define dprintf(format...) {IExec->Forbid();IExec->DebugPrintF("%s: ",IExec->FindTask(NULL)->tc_Node.ln_Name);IExec->DebugPrintF(format);IExec->Permit();}
//fprintf_unfiltered(gdb_stderr, ## format); 
#else
#define dprintf(format...)
#define FUNC
#define FUNCX
#endif

#define __USE_BASETYPE__
#include <sys/time.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/elf.h>

#include <exec/exec.h>
#include <exec/exectags.h>
#include <exec/ports.h>
#include <exec/interrupts.h>

#include <dos/dos.h>
#include <dos/dostags.h>
#include <dos/dosextens.h>

#include <strings.h>

#define    MSR_TRACE_ENABLE           0x00000400
#define    EXC_FPE                    0x00100000
#define    EXC_ILLEGAL                0x00080000
#define    EXC_PRIV                   0x00040000
#define    EXC_TRAP                   0x00020000
#define    MAX_DEBUG_MESSAGES         20

#define    TASK_TERMINATED            0x00000001
#define    TASK_ATTACHED              0x00000002
#define    TASK_INTERRUPTED           0x00000004
#define       TASK_OPENLIB               0x00000008
#define       TASK_CLOSELIB              0x00000010

extern struct ExecBase *SysBase;

static 
struct target_ops amigaos_ops;

struct DebugIFace *IDebug 0;
struct Library *ElfBase 0;
struct ElfIFace *IElf 0;
struct MMUIFace *IMMU 0;




/*
 * STATIC FUNCTION DECLARATIONS
 */

/** Called from init.c */
static void init_amigaos_ops (void);



/*
 * STATIC FUNCTION DEFINITIONS
 */

static void init_amigaos_ops (void)
{
    
/*
     * start by clearing all entries so we should get a NULL pointer
     * if we try to access anything that hasn't been set. So
     * in case an edit below removes a function pointer value, we'll
     * get a NULL pointer exception rather than accesing a junk value
     * in memory.
     */
    
memset (&amigaos_opssizeof (struct target_ops), 0);

    
/* To the target under this one.  */
    
amigaos_ops.beneath NULL;

    
/* Name this target type */
    
amigaos_ops.to_shortname "subtask";

    
/* Name for printing */
    
amigaos_ops.to_longname "Debug an Amiga process";

    
/*
     * Documentation.  Does not include trailing newline, and starts
     * with a one-line description (probably similar to to_longname).
     */
    
amigaos_ops.to_doc "Debug a Task/Process running on AmigaOS 4\n"
            "Use \"
target subtask <process_id>\" to attach";

    
/* Per-target scratch pad.  */
    
amigaos_ops.to_data NULL;

    
/* The open routine takes the rest of the parameters from the
         command, and (if successful) pushes a new target onto the
         stack.  Targets should supply this routine, if only to provide
         an error message.  */
    
amigaos_ops.to_open NULL;

    
/* Old targets with a static target vector provide "to_close".
         New re-entrant targets provide "to_xclose" and that is expected
         to xfree everything (including the "struct target_ops").  */
    
amigaos_ops.to_xclose NULL;
    
amigaos_ops.to_close NULL;
    
amigaos_ops.to_attach NULL;
    
amigaos_ops.to_post_attach NULL;
    
amigaos_ops.to_detach NULL;
    
amigaos_ops.to_disconnect NULL;
    
amigaos_ops.to_resume NULL;
    
amigaos_ops.to_wait NULL;
    
amigaos_ops.to_fetch_registers NULL;
    
amigaos_ops.to_store_registers NULL;
    
amigaos_ops.to_prepare_to_store NULL;

    
/* Transfer LEN bytes of memory between GDB address MYADDR and
         target address MEMADDR.  If WRITE, transfer them to the target, else
         transfer them from the target.  TARGET is the target from which we
         get this function.

         Return value, N, is one of the following:

         0 means that we can't handle this.  If errno has been set, it is the
         error which prevented us from doing it (FIXME: What about bfd_error?).

         positive (call it N) means that we have transferred N bytes
         starting at MEMADDR.  We might be able to handle more bytes
         beyond this length, but no promises.

         negative (call its absolute value N) means that we cannot
         transfer right at MEMADDR, but we could transfer at least
         something at MEMADDR + N.

         NOTE: cagney/2004-10-01: This has been entirely superseeded by
         to_xfer_partial and inferior inheritance.  */
    
amigaos_ops.deprecated_xfer_memory NULL;

    
amigaos_ops.to_files_info NULL;
    
amigaos_ops.to_insert_breakpoint NULL;
    
amigaos_ops.to_remove_breakpoint NULL;
    
amigaos_ops.to_can_use_hw_breakpoint NULL;
    
amigaos_ops.to_ranged_break_num_registers NULL;
    
amigaos_ops.to_insert_hw_breakpoint NULL;
    
amigaos_ops.to_remove_hw_breakpoint NULL;

    
/* Documentation of what the two routines below are expected to do is
         provided with the corresponding target_* macros.  */
    
amigaos_ops.to_remove_watchpoint NULL;
    
amigaos_ops.to_insert_watchpoint NULL;

    
amigaos_ops.to_insert_mask_watchpoint NULL;

    
amigaos_ops.to_remove_mask_watchpoint NULL;

    
amigaos_ops.to_stopped_by_watchpoint NULL;
    
amigaos_ops.to_have_steppable_watchpoint 0;
    
amigaos_ops.to_have_continuable_watchpoint 0;
    
amigaos_ops.to_stopped_data_address NULL;
    
amigaos_ops.to_watchpoint_addr_within_range NULL;

    
/* Documentation of this routine is provided with the corresponding
         target_* macro.  */
    
amigaos_ops.to_region_ok_for_hw_watchpoint NULL;

    
amigaos_ops.to_can_accel_watchpoint_condition NULL;
    
amigaos_ops.to_masked_watch_num_registers NULL;
    
amigaos_ops.to_terminal_init NULL;
    
amigaos_ops.to_terminal_inferior NULL;
    
amigaos_ops.to_terminal_ours_for_output NULL;
    
amigaos_ops.to_terminal_ours NULL;
    
amigaos_ops.to_terminal_save_ours NULL;
    
amigaos_ops.to_terminal_info NULL;
    
amigaos_ops.to_kill NULL;
    
amigaos_ops.to_load NULL;
    
amigaos_ops.to_create_inferior NULL;
    
amigaos_ops.to_post_startup_inferior NULL;
    
amigaos_ops.to_insert_fork_catchpoint NULL;
    
amigaos_ops.to_remove_fork_catchpoint NULL;
    
amigaos_ops.to_insert_vfork_catchpoint NULL;
    
amigaos_ops.to_remove_vfork_catchpoint NULL;
    
amigaos_ops.to_follow_fork NULL;
    
amigaos_ops.to_insert_exec_catchpoint NULL;
    
amigaos_ops.to_remove_exec_catchpoint NULL;
    
amigaos_ops.to_set_syscall_catchpoint NULL;
    
amigaos_ops.to_has_exited NULL;
    
amigaos_ops.to_mourn_inferior NULL;
    
amigaos_ops.to_can_run NULL;

    
/* Documentation of this routine is provided with the corresponding
         target_* macro.  */
    
amigaos_ops.to_pass_signals NULL;

    
/* Documentation of this routine is provided with the
         corresponding target_* function.  */
    
amigaos_ops.to_program_signals NULL;

    
amigaos_ops.to_thread_alive NULL;
    
amigaos_ops.to_find_new_threads NULL;
    
amigaos_ops.to_pid_to_str NULL;
    
amigaos_ops.to_extra_thread_info NULL;
    
amigaos_ops.to_thread_name NULL;
    
amigaos_ops.to_stop NULL;
    
amigaos_ops.to_rcmd NULL;
    
amigaos_ops.to_pid_to_exec_file NULL;
    
amigaos_ops.to_log_command NULL;
    
amigaos_ops.to_get_section_table NULL;

    
amigaos_ops.to_stratum dummy_stratum;

    
amigaos_ops.to_has_all_memory NULL;
    
amigaos_ops.to_has_memory NULL;
    
amigaos_ops.to_has_stack NULL;
    
amigaos_ops.to_has_registers NULL;
    
amigaos_ops.to_has_execution NULL;

    
/* control thread execution */
    
amigaos_ops.to_has_thread_control 0;

    
amigaos_ops.to_attach_no_wait 0;

    
/* ASYNC target controls */
    
amigaos_ops.to_can_async_p NULL;
    
amigaos_ops.to_is_async_p NULL;
    
amigaos_ops.to_async NULL;
    
amigaos_ops.to_supports_non_stop NULL;

    
/* find_memory_regions support method for gcore */
    
amigaos_ops.to_find_memory_regions NULL;

    
/* make_corefile_notes support method for gcore */
    
amigaos_ops.to_make_corefile_notes NULL;

    
/* get_bookmark support method for bookmarks */
    
amigaos_ops.to_get_bookmark NULL;

    
/* goto_bookmark support method for bookmarks */
    
amigaos_ops.to_goto_bookmark NULL;

    
/* Return the thread-local address at OFFSET in the
         thread-local storage for the thread PTID and the shared library
         or executable file given by OBJFILE.  If that block of
         thread-local storage hasn't been allocated yet, this function
         may return an error.  */
    
amigaos_ops.to_get_thread_local_address NULL;

    
/* Request that OPS transfer up to LEN 8-bit bytes of the target's
         OBJECT.  The OFFSET, for a seekable object, specifies the
         starting point.  The ANNEX can be used to provide additional
         data-specific information to the target.

         Return the number of bytes actually transfered, zero when no
         further transfer is possible, and -1 when the transfer is not
         supported.  Return of a positive value smaller than LEN does
         not indicate the end of the object, only the end of the
         transfer; higher level code should continue transferring if
         desired.  This is handled in target.c.

         The interface does not support a "retry" mechanism.  Instead it
         assumes that at least one byte will be transfered on each
         successful call.

         NOTE: cagney/2003-10-17: The current interface can lead to
         fragmented transfers.  Lower target levels should not implement
         hacks, such as enlarging the transfer, in an attempt to
         compensate for this.  Instead, the target stack should be
         extended so that it implements supply/collect methods and a
         look-aside object cache.  With that available, the lowest
         target can safely and freely "push" data up the stack.

         See target_read and target_write for more information.  One,
         and only one, of readbuf or writebuf must be non-NULL.  */

    
amigaos_ops.to_xfer_partial NULL;

    
/* Returns the memory map for the target.  A return value of NULL
         means that no memory map is available.  If a memory address
         does not fall within any returned regions, it's assumed to be
         RAM.  The returned memory regions should not overlap.

         The order of regions does not matter; target_memory_map will
         sort regions by starting address.  For that reason, this
         function should not be called directly except via
         target_memory_map.

         This method should not cache data; if the memory map could
         change unexpectedly, it should be invalidated, and higher
         layers will re-fetch it.  */
    
amigaos_ops.to_memory_map NULL;

    
/* Erases the region of flash memory starting at ADDRESS, of
         length LENGTH.

         Precondition: both ADDRESS and ADDRESS+LENGTH should be aligned
         on flash block boundaries, as reported by 'to_memory_map'.  */
    
amigaos_ops.to_flash_erase NULL;

    
/* Finishes a flash memory write sequence.  After this operation
         all flash memory should be available for writing and the result
         of reading from areas written by 'to_flash_write' should be
         equal to what was written.  */
    
amigaos_ops.to_flash_done NULL;

    
/* Describe the architecture-specific features of this target.
         Returns the description found, or NULL if no description
         was available.  */
    
amigaos_ops.to_read_description NULL;

    
/* Build the PTID of the thread on which a given task is running,
         based on LWP and THREAD.  These values are extracted from the
         task Private_Data section of the Ada Task Control Block, and
         their interpretation depends on the target.  */
    
amigaos_ops.to_get_ada_task_ptid NULL;

    
/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
         Return 0 if *READPTR is already at the end of the buffer.
         Return -1 if there is insufficient buffer for a whole entry.
         Return 1 if an entry was read into *TYPEP and *VALP.  */
    
amigaos_ops.to_auxv_parse NULL;

    
/* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
         sequence of bytes in PATTERN with length PATTERN_LEN.

         The result is 1 if found, 0 if not found, and -1 if there was an error
         requiring halting of the search (e.g. memory read error).
         If the pattern is found the address is recorded in FOUND_ADDRP.  */
    
amigaos_ops.to_search_memory NULL;

    
/* Can target execute in reverse?  */
    
amigaos_ops.to_can_execute_reverse NULL;

    
/* The direction the target is currently executing.  Must be
         implemented on targets that support reverse execution and async
         mode.  The default simply returns forward execution.  */
    
amigaos_ops.to_execution_direction NULL;

    
/* Does this target support debugging multiple processes
         simultaneously?  */
    
amigaos_ops.to_supports_multi_process NULL;

    
/* Does this target support enabling and disabling tracepoints while a trace
         experiment is running?  */
    
amigaos_ops.to_supports_enable_disable_tracepoint NULL;

    
/* Does this target support disabling address space randomization?  */
    
amigaos_ops.to_supports_disable_randomization NULL;

    
/* Does this target support the tracenz bytecode for string collection?  */
    
amigaos_ops.to_supports_string_tracing NULL;

    
/* Does this target support evaluation of breakpoint conditions on its
         end?  */
    
amigaos_ops.to_supports_evaluation_of_breakpoint_conditions NULL;

    
/* Does this target support evaluation of breakpoint commands on its
         end?  */
    
amigaos_ops.to_can_run_breakpoint_commands NULL;

    
/* Determine current architecture of thread PTID.

         The target is supposed to determine the architecture of the code where
         the target is currently stopped at (on Cell, if a target is in spu_run,
         to_thread_architecture would return SPU, otherwise PPC32 or PPC64).
         This is architecture used to perform decr_pc_after_break adjustment,
         and also determines the frame architecture of the innermost frame.
         ptrace operations need to operate according to target_gdbarch.

         The default implementation always returns target_gdbarch.  */
    
amigaos_ops.to_thread_architecture NULL;

    
/* Determine current address space of thread PTID.

         The default implementation always returns the inferior's
         address space.  */
    
amigaos_ops.to_thread_address_space NULL;

    
/* Target file operations.  */

    /* Open FILENAME on the target, using FLAGS and MODE.  Return a
         target file descriptor, or -1 if an error occurs (and set
         *TARGET_ERRNO).  */
    
amigaos_ops.to_fileio_open NULL;

    
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
         Return the number of bytes written, or -1 if an error occurs
         (and set *TARGET_ERRNO).  */
    
amigaos_ops.to_fileio_pwrite NULL;

    
/* Read up to LEN bytes FD on the target into READ_BUF.
         Return the number of bytes read, or -1 if an error occurs
         (and set *TARGET_ERRNO).  */
    
amigaos_ops.to_fileio_pread NULL;

    
/* Close FD on the target.  Return 0, or -1 if an error occurs
         (and set *TARGET_ERRNO).  */
    
amigaos_ops.to_fileio_close NULL;

    
/* Unlink FILENAME on the target.  Return 0, or -1 if an error
         occurs (and set *TARGET_ERRNO).  */
    
amigaos_ops.to_fileio_unlink NULL;

    
/* Read value of symbolic link FILENAME on the target.  Return a
         null-terminated string allocated via xmalloc, or NULL if an error
         occurs (and set *TARGET_ERRNO).  */
    
amigaos_ops.to_fileio_readlink NULL;


    
/* Implement the "info proc" command.  */
    
amigaos_ops.to_info_proc NULL;

    
/* Tracepoint-related operations.  */

    /* Prepare the target for a tracing run.  */
    
amigaos_ops.to_trace_init NULL;

    
/* Send full details of a tracepoint location to the target.  */
    
amigaos_ops.to_download_tracepoint NULL;

    
/* Is the target able to download tracepoint locations in current
         state?  */
    
amigaos_ops.to_can_download_tracepoint NULL;

    
/* Send full details of a trace state variable to the target.  */
    
amigaos_ops.to_download_trace_state_variable NULL;

    
/* Enable a tracepoint on the target.  */
    
amigaos_ops.to_enable_tracepoint NULL;

    
/* Disable a tracepoint on the target.  */
    
amigaos_ops.to_disable_tracepoint NULL;

    
/* Inform the target info of memory regions that are readonly
         (such as text sections), and so it should return data from
         those rather than look in the trace buffer.  */
    
amigaos_ops.to_trace_set_readonly_regions NULL;

    
/* Start a trace run.  */
    
amigaos_ops.to_trace_start NULL;

    
/* Get the current status of a tracing run.  */
    
amigaos_ops.to_get_trace_status NULL;

    
amigaos_ops.to_get_tracepoint_status NULL;

    
/* Stop a trace run.  */
    
amigaos_ops.to_trace_stop NULL;

 
/* Ask the target to find a trace frame of the given type TYPE,
        using NUM, ADDR1, and ADDR2 as search parameters.  Returns the
        number of the trace frame, and also the tracepoint number at
        TPP.  If no trace frame matches, return -1.  May throw if the
        operation fails.  */
    
amigaos_ops.to_trace_find NULL;

    
/* Get the value of the trace state variable number TSV, returning
         1 if the value is known and writing the value itself into the
         location pointed to by VAL, else returning 0.  */
    
amigaos_ops.to_get_trace_state_variable_value NULL;

    
amigaos_ops.to_save_trace_data NULL;

    
amigaos_ops.to_upload_tracepoints NULL;

    
amigaos_ops.to_upload_trace_state_variables NULL;

    
amigaos_ops.to_get_raw_trace_data NULL;

    
/* Get the minimum length of instruction on which a fast tracepoint
         may be set on the target.  If this operation is unsupported,
         return -1.  If for some reason the minimum length cannot be
         determined, return 0.  */
    
amigaos_ops.to_get_min_fast_tracepoint_insn_len NULL;

    
/* Set the target's tracing behavior in response to unexpected
         disconnection - set VAL to 1 to keep tracing, 0 to stop.  */
    
amigaos_ops.to_set_disconnected_tracing NULL;
    
amigaos_ops.to_set_circular_trace_buffer NULL;

    
/* Add/change textual notes about the trace run, returning 1 if
         successful, 0 otherwise.  */
    
amigaos_ops.to_set_trace_notes NULL;

    
/* Return the processor core that thread PTID was last seen on.
         This information is updated only when:
         - update_thread_list is called
         - thread stops
         If the core cannot be determined -- either for the specified
         thread, or right now, or in this debug session, or for this
         target -- return -1.  */
    
amigaos_ops.to_core_of_thread NULL;

    
/* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
         matches the contents of [DATA,DATA+SIZE).  Returns 1 if there's
         a match, 0 if there's a mismatch, and -1 if an error is
         encountered while reading memory.  */
    
amigaos_ops.to_verify_memory NULL;

    
/* Return the address of the start of the Thread Information Block
         a Windows OS specific feature.  */
    
amigaos_ops.to_get_tib_address NULL;

    
/* Send the new settings of write permission variables.  */
    
amigaos_ops.to_set_permissions NULL;

    
/* Look for a static tracepoint marker at ADDR, and fill in MARKER
         with its details.  Return 1 on success, 0 on failure.  */
    
amigaos_ops.to_static_tracepoint_marker_at NULL;

    
/* Return a vector of all tracepoints markers string id ID, or all
         markers if ID is NULL.  */
    
amigaos_ops.to_static_tracepoint_markers_by_strid NULL;

    
/* Return a traceframe info object describing the current
         traceframe's contents.  This method should not cache data;
         higher layers take care of caching, invalidating, and
         re-fetching when necessary.  */
    
amigaos_ops.to_traceframe_info NULL;

    
/* Ask the target to use or not to use agent according to USE.  Return 1
         successful, 0 otherwise.  */
    
amigaos_ops.to_use_agent NULL;

    
/* Is the target able to use agent in current state?  */
    
amigaos_ops.to_can_use_agent NULL;

    
amigaos_ops.to_magic 0;
    
/* Need sub-structure for target machine related rather than comm related?
     */
}

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Ok I'm now on it, expect a pull request in the next few hours

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Quote:

My bet we need to just write amigaos-nat from scratch now. Just function by function. So we will then understand everything. Firstly create_inferior, then one fetching registers, etc, etc. That will be easier than tweaking old stuff.


I agree, I think the reason we're hitting issues like this are because we're using code that used the previous GDB API and we're better off adpating to the new API instead. we've got this source plus the morphos one (thanks for that!), and the code for spotless so we have enough examples so let's do each function in turn for the new API.

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Could you send me the morphos-nat.c file? I take that their gdb works yeah?

I've also discovered that alfkil's spotless is on github which may be a way to go as at least the codebase is amiga and simpler!

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Yeah looking at the Windows nat for instance, it didn't have to explicitly add the inferior, I may try debugging that to see how it deals with setting up its inferior.

add_inferior_with_spaces () is basically a wrapper around add_inferior (). I've been delving into the gdb internals manual at https://sourceware.org/gdb/wiki/Internals so see if that helps.

You're right in that currently it feels like trying to tweak the existing code and I'm not sure if we're adding the code in the right place for instance with this inferior stuff.

amigaos_create_inferior() creates the inferior absolutely fine, the issue is that the call to find_inferior_pid () at target.c:3249 returns NULL. The code for that is in inferior.c:

struct inferior *
find_inferior_pid (int pid)
{
  
struct inferior *inf;

  
/* Looking for inferior pid == 0 is always wrong, and indicative of
     a bug somewhere else.  There may be more than one with pid == 0,
     for instance.  */
  
gdb_assert (pid != 0);

  for (
inf inferior_listinfinf inf->next)
    if (
inf->pid == pid)
      return 
inf;

  return 
NULL;
}


where inferior_list is a list of all the current inferiors and our amiga one isn't on there.

In inferior.c the api for adding inferiors to this list are

add_inferior ()
add_inferior_with_spaces ()
add_inferior_silent ()


If we use add_inferior () which is essentially add_inferior_silent () with a log message, then at target.c:3251 we fail due to inf -> aspace being NULL

if (inf == NULL || inf->aspace == NULL)






Go to top


Re: GDB
Just popping in
Just popping in


@kas1e


Added few printfs, and:

1). for first we never go inside of the for (current_target.beneath!= NULLt->beneathloop.
2). when we "fallback"inf is NULL too.


Ok here's what I've found so far. The inferior created by amigaos_create_inferior () is never added to the inferior list in inferior.c. If I add

add_inferior ((int) debug_data.current_process);


then it gets added to the list and

inf find_inferior_pid (pid);


on target.c:3249 now finds the inferior but it has aspace = NULL.

So add_inferior () isn't enough to get the aspace and pspace parts of the resulting inferior set up.

Changing the added code to

inf_p add_inferior_with_spaces ();

if (
inf_p)
  {
    
inf_p -> pid = (int) debug_data.current_process;
  }



seems a bit hacky but then gdb runs all the way through without crashing but not with its functionality all working.

Now add_inferior_with_spaces () adds a new address space rather than all of the gdb inferiors sharing a single address space which is because gdbarch_has_shared_address_space() returns 0.

So does OS4 have a shared address space? If so we can call set_gdbarch_has_shared_address_space() and may get further.
Otherwise we need to set up the inferior with the correct aspace, pspace values, etc.


Go to top


Re: OS4 Reaction programming question (beginner)
Just popping in
Just popping in


I think you're missing the requester parameter, which can be NULL, and the TAG_DONE as the final argument, try:

IIntuition->SetGadgetAttrs(gb_StringGadgb_WindowObjNULLSTRINGA_TextVal"changed"TAG_DONE);

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

The reason I've been looking at the debug interface isn't for the x5000, it's that functions like ObtainDebugSymbol() and StackTrace() may be what we need to be able to do things like inspect a variable by its name rather than having to inspect registers or anything like that.

Go to top


Re: Memory protection and tasks/processes
Just popping in
Just popping in


@afxgroup

Is that a paste error? Do you mean

struct SignalSemaphore locale_lock AllocSysObject(ASOT_SEMAPHORE,NULL)


The other thing is the other example is a struct variable on the stack so it must be different code compared to your AllocSysObject () code returning a pointer, yeah? I'm assuming since the stack-based code is in a single function, could you show us the code in that function for both scenarios?



Edited by billyfish on 2021/3/6 20:21:01
Go to top


Re: Memory protection and tasks/processes
Just popping in
Just popping in


@afxgroup

Ok do you want to paste the contructor and usage code to see if anything can be spotted? Do your number of calls to ObtainSemaphore (), ObtainSemaphoreShared () and AttemptSemaphore () match the number of ReleaseSemaphore() calls? Is it a public Semaphore? If so, is there a call to RemSemaphore () before the CLIB_DESTRUCTOR? I'm just trying to think of possible causes off the top of my head?

Go to top


Re: Memory protection and tasks/processes
Just popping in
Just popping in


@afxgroup


No idea if this is relevant but setting semaphore to NULL only affects the local copy of the semaphore variable in that function won't it? So if you're using the semaphore elsewhere in your program after calling this it will have been freed and won't be NULL. If you want it to be reflected elsewhere in the program, you'd need to pass in a struct SignalSemaphore **sem variable and set *sem to NULL.

Go to top


Re: GDB
Just popping in
Just popping in


@kas1e

Sorry, home schooling keeps getting in the way! After Monday, it will be easier as they'll be back in school. As for GDB, we've made good progress, we'll get there I've been taking a look at the IExec debug interface too

Go to top



TopTop
« 1 (2) 3 4 5 ... 9 »




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project