~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Runtime/common/dbg/dbgmod.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 * additional information or have any questions.
29
29
 */
30
30
 
 
31
 
31
32
/*******************************************************************************
32
33
*   Header Files                                                               *
33
34
*******************************************************************************/
34
35
#include <iprt/dbg.h>
 
36
#include "internal/iprt.h"
35
37
 
36
38
#include <iprt/asm.h>
37
39
#include <iprt/assert.h>
304
306
    RTMemFree(pDbgMod);
305
307
    return rc;
306
308
}
 
309
RT_EXPORT_SYMBOL(RTDbgModCreate);
307
310
 
308
311
 
309
312
RTDECL(int)         RTDbgModCreateDeferred(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR cb, uint32_t fFlags)
310
313
{
311
314
    return VERR_NOT_IMPLEMENTED;
312
315
}
 
316
RT_EXPORT_SYMBOL(RTDbgModCreateDeferred);
313
317
 
314
318
 
315
319
RTDECL(int)         RTDbgModCreateFromImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t fFlags)
316
320
{
317
321
    return VERR_NOT_IMPLEMENTED;
318
322
}
 
323
RT_EXPORT_SYMBOL(RTDbgModCreateFromImage);
319
324
 
320
325
 
321
326
RTDECL(int) RTDbgModCreateFromMap(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR uSubtrahend, uint32_t fFlags)
392
397
    RTMemFree(pDbgMod);
393
398
    return rc;
394
399
}
 
400
RT_EXPORT_SYMBOL(RTDbgModCreateFromMap);
395
401
 
396
402
 
397
403
/**
448
454
    RTDBGMOD_VALID_RETURN_RC(pDbgMod, UINT32_MAX);
449
455
    return ASMAtomicIncU32(&pDbgMod->cRefs);
450
456
}
 
457
RT_EXPORT_SYMBOL(RTDbgModRetain);
451
458
 
452
459
 
453
460
/**
474
481
        rtDbgModDestroy(pDbgMod);
475
482
    return cRefs;
476
483
}
 
484
RT_EXPORT_SYMBOL(RTDbgModRelease);
477
485
 
478
486
 
479
487
/**
489
497
    RTDBGMOD_VALID_RETURN_RC(pDbgMod, NULL);
490
498
    return pDbgMod->pszName;
491
499
}
 
500
RT_EXPORT_SYMBOL(RTDbgModName);
492
501
 
493
502
 
494
503
/**
513
522
    RTDBGMOD_UNLOCK(pDbgMod);
514
523
    return iSeg;
515
524
}
 
525
RT_EXPORT_SYMBOL(RTDbgModRvaToSegOff);
516
526
 
517
527
 
518
528
/**
537
547
    RTDBGMOD_UNLOCK(pDbgMod);
538
548
    return cbImage;
539
549
}
 
550
RT_EXPORT_SYMBOL(RTDbgModImageSize);
 
551
 
 
552
 
 
553
/**
 
554
 * Gets the module tag value if any.
 
555
 *
 
556
 * @returns The tag. 0 if hDbgMod is invalid.
 
557
 *
 
558
 * @param   hDbgMod         The module handle.
 
559
 */
 
560
RTDECL(uint64_t) RTDbgModGetTag(RTDBGMOD hDbgMod)
 
561
{
 
562
    PRTDBGMODINT pDbgMod = hDbgMod;
 
563
    RTDBGMOD_VALID_RETURN_RC(pDbgMod, 0);
 
564
    return pDbgMod->uTag;
 
565
}
 
566
RT_EXPORT_SYMBOL(RTDbgModGetTag);
 
567
 
 
568
 
 
569
/**
 
570
 * Tags or untags the module.
 
571
 *
 
572
 * @returns IPRT status code.
 
573
 * @retval  VERR_INVALID_HANDLE if hDbgMod is invalid.
 
574
 *
 
575
 * @param   hDbgMod         The module handle.
 
576
 * @param   uTag            The tag value.  The convention is that 0 is no tag
 
577
 *                          and any other value means it's tagged.  It's adviced
 
578
 *                          to use some kind of unique number like an address
 
579
 *                          (global or string cache for instance) to avoid
 
580
 *                          collisions with other users
 
581
 */
 
582
RTDECL(int) RTDbgModSetTag(RTDBGMOD hDbgMod, uint64_t uTag)
 
583
{
 
584
    PRTDBGMODINT pDbgMod = hDbgMod;
 
585
    RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
 
586
    RTDBGMOD_LOCK(pDbgMod);
 
587
 
 
588
    pDbgMod->uTag = uTag;
 
589
 
 
590
    RTDBGMOD_UNLOCK(pDbgMod);
 
591
    return VINF_SUCCESS;
 
592
}
 
593
RT_EXPORT_SYMBOL(RTDbgModSetTag);
540
594
 
541
595
 
542
596
/**
595
649
    return rc;
596
650
 
597
651
}
 
652
RT_EXPORT_SYMBOL(RTDbgModSegmentAdd);
598
653
 
599
654
 
600
655
/**
619
674
    RTDBGMOD_UNLOCK(pDbgMod);
620
675
    return cSegs;
621
676
}
 
677
RT_EXPORT_SYMBOL(RTDbgModSegmentCount);
622
678
 
623
679
 
624
680
/**
650
706
    RTDBGMOD_UNLOCK(pDbgMod);
651
707
    return rc;
652
708
}
 
709
RT_EXPORT_SYMBOL(RTDbgModSegmentByIndex);
653
710
 
654
711
 
655
712
/**
674
731
    int rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo);
675
732
    return RT_SUCCESS(rc) ? SegInfo.cb : RTUINTPTR_MAX;
676
733
}
 
734
RT_EXPORT_SYMBOL(RTDbgModSegmentSize);
677
735
 
678
736
 
679
737
/**
695
753
    int rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo);
696
754
    return RT_SUCCESS(rc) ? SegInfo.uRva : RTUINTPTR_MAX;
697
755
}
 
756
RT_EXPORT_SYMBOL(RTDbgModSegmentRva);
698
757
 
699
758
 
700
759
/**
768
827
    RTDBGMOD_UNLOCK(pDbgMod);
769
828
    return rc;
770
829
}
 
830
RT_EXPORT_SYMBOL(RTDbgModSymbolAdd);
771
831
 
772
832
 
773
833
/**
793
853
    RTDBGMOD_UNLOCK(pDbgMod);
794
854
    return cSymbols;
795
855
}
 
856
RT_EXPORT_SYMBOL(RTDbgModSymbolCount);
796
857
 
797
858
 
798
859
/**
820
881
    RTDBGMOD_UNLOCK(pDbgMod);
821
882
    return rc;
822
883
}
 
884
RT_EXPORT_SYMBOL(RTDbgModSymbolByOrdinal);
823
885
 
824
886
 
825
887
/**
855
917
        RTDbgSymbolFree(pSymInfo);
856
918
    return rc;
857
919
}
 
920
RT_EXPORT_SYMBOL(RTDbgModSymbolByOrdinalA);
858
921
 
859
922
 
860
923
/**
915
978
    RTDBGMOD_UNLOCK(pDbgMod);
916
979
    return rc;
917
980
}
 
981
RT_EXPORT_SYMBOL(RTDbgModSymbolByAddr);
918
982
 
919
983
 
920
984
/**
961
1025
        RTDbgSymbolFree(pSymInfo);
962
1026
    return rc;
963
1027
}
 
1028
RT_EXPORT_SYMBOL(RTDbgModSymbolByAddrA);
964
1029
 
965
1030
 
966
1031
/**
998
1063
 
999
1064
    return rc;
1000
1065
}
 
1066
RT_EXPORT_SYMBOL(RTDbgModSymbolByName);
1001
1067
 
1002
1068
 
1003
1069
/**
1033
1099
        RTDbgSymbolFree(pSymInfo);
1034
1100
    return rc;
1035
1101
}
 
1102
RT_EXPORT_SYMBOL(RTDbgModSymbolByNameA);
1036
1103
 
1037
1104
 
1038
1105
/**
1101
1168
    RTDBGMOD_UNLOCK(pDbgMod);
1102
1169
    return rc;
1103
1170
}
 
1171
RT_EXPORT_SYMBOL(RTDbgModLineAdd);
1104
1172
 
1105
1173
 
1106
1174
/**
1126
1194
    RTDBGMOD_UNLOCK(pDbgMod);
1127
1195
    return cLineNumbers;
1128
1196
}
 
1197
RT_EXPORT_SYMBOL(RTDbgModLineCount);
1129
1198
 
1130
1199
 
1131
1200
/**
1156
1225
    RTDBGMOD_UNLOCK(pDbgMod);
1157
1226
    return rc;
1158
1227
}
 
1228
RT_EXPORT_SYMBOL(RTDbgModLineByOrdinal);
1159
1229
 
1160
1230
 
1161
1231
/**
1194
1264
        RTDbgLineFree(pLineInfo);
1195
1265
    return rc;
1196
1266
}
 
1267
RT_EXPORT_SYMBOL(RTDbgModLineByOrdinalA);
1197
1268
 
1198
1269
 
1199
1270
/**
1252
1323
    RTDBGMOD_UNLOCK(pDbgMod);
1253
1324
    return rc;
1254
1325
}
 
1326
RT_EXPORT_SYMBOL(RTDbgModLineByAddr);
1255
1327
 
1256
1328
 
1257
1329
/**
1299
1371
        RTDbgLineFree(pLineInfo);
1300
1372
    return rc;
1301
1373
}
 
1374
RT_EXPORT_SYMBOL(RTDbgModLineByAddrA);
1302
1375